clientToolsRouter

A prebuilt conditional-edge callback. serverToolNames is bound once at construction; the returned function takes only state.

graph.addConditionalEdges('agent', clientToolsRouter(names), ['server_tools', END]);

opts.toolsNode defaults to 'server_tools'; a graph carrying the client-tool channels cannot name a node tools, because clientToolsChannel already claims that name as a state channel.

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

Declaration · overload 1

export declare function clientToolsRouter(serverToolNames: Iterable<string>, opts?: {
    toolsNode?: string;
    end?: string;
}): (state: ClientToolsState) => string;

Parameters

serverToolNames · required
Iterable<string>
opts · optional
{ toolsNode?: string; end?: string; }

Returns

(state: ClientToolsState) => string