(defs: ToolDefinition[], clientName: string | undefined)
| 105 | * the proxy, like {@link instructionsForClient}. |
| 106 | */ |
| 107 | export 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). */ |
| 123 | export const PROTOCOL_VERSION = '2024-11-05'; |
no test coverage detected