MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / toolsForClient

Function toolsForClient

src/mcp/session.ts:107–120  ·  view source on GitHub ↗
(defs: ToolDefinition[], clientName: string | undefined)

Source from the content-addressed store, hash-verified

105 * the proxy, like {@link instructionsForClient}.
106 */
107export function toolsForClient(defs: ToolDefinition[], clientName: string | undefined): ToolDefinition[] {
108 if (!isOpenCodeClient(clientName)) return defs;
109 const rename = (text: string): string => withOpenCodeToolNames(text, TOOL_NAMES);
110 return defs.map((tool) => ({
111 ...tool,
112 description: rename(tool.description),
113 inputSchema: {
114 ...tool.inputSchema,
115 properties: Object.fromEntries(
116 Object.entries(tool.inputSchema.properties).map(([key, prop]) => [key, { ...prop, description: rename(prop.description) }]),
117 ),
118 },
119 }));
120}
121
122/** MCP Protocol Version (latest the server claims). */
123export const PROTOCOL_VERSION = '2024-11-05';

Callers 2

runLocalHandshakeProxyFunction · 0.90
handleToolsListMethod · 0.85

Calls 3

isOpenCodeClientFunction · 0.90
mapMethod · 0.80
renameFunction · 0.70

Tested by

no test coverage detected