Middleware · API Reference

bindClientTools()

bindClientTools() is the main helper from @threadplane/middleware/langgraph. It binds your server tools plus the current run's client-tool catalog onto a LangChain chat model.

import {
  bindClientTools,
  clientToolsChannel,
  clientToolsRouter,
} from '@threadplane/middleware/langgraph';

There is no root JavaScript entry point for @threadplane/middleware; import from the /langgraph subpath.

Related helpers in the same entry point include clientToolsChannel(), clientToolsRouter(), clientToolSpecs(), clientToolNames(), hasClientToolCall(), hasServerToolCall(), routeAfterAgent(), and lastMessage().

bindClientToolsfunction

Bind server tools + the client catalog stubs onto `llm`. Call this INSIDE the agent node (per-run) — the client catalog arrives in state and may differ per run.

bindClientTools(llm: M, serverTools: unknown[], state: ClientToolsState): ReturnType<M["bindTools"]>

Parameters

ParameterTypeDescription
llmM
serverToolsunknown[]
stateClientToolsState

Returns

ReturnType<M["bindTools"]>