(tool: ToolDefinition | DefinedPageTool)
| 157 | const toolMutex = new Mutex(); |
| 158 | |
| 159 | function registerTool(tool: ToolDefinition | DefinedPageTool): void { |
| 160 | const toolHandler = new ToolHandler( |
| 161 | tool, |
| 162 | serverArgs, |
| 163 | getContext, |
| 164 | toolMutex, |
| 165 | ); |
| 166 | |
| 167 | if (!toolHandler.shouldRegister) { |
| 168 | return; |
| 169 | } |
| 170 | |
| 171 | server.registerTool( |
| 172 | tool.name, |
| 173 | { |
| 174 | description: tool.description, |
| 175 | inputSchema: toolHandler.registeredInputSchema, |
| 176 | annotations: tool.annotations, |
| 177 | }, |
| 178 | async (params): Promise<CallToolResult> => { |
| 179 | return await toolHandler.handle(params); |
| 180 | }, |
| 181 | ); |
| 182 | } |
| 183 | |
| 184 | const tools = createTools(serverArgs); |
| 185 | for (const tool of tools) { |
no test coverage detected