File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,12 @@ export class Server {
3434 this . registerTools ( ) ;
3535 this . registerResources ( ) ;
3636
37+ // This is a workaround for an issue we've seen with some models, where they'll see that everything in the `arguments`
38+ // object is optional, and then not pass it at all. However, the MCP server expects the `arguments` object to be if
39+ // the tool accepts any arguments, even if they're all optional.
40+ //
41+ // see: https://github.com/modelcontextprotocol/typescript-sdk/blob/131776764536b5fdca642df51230a3746fb4ade0/src/server/mcp.ts#L705
42+ // Since paramsSchema here is not undefined, the server will create a non-optional z.object from it.
3743 const existingHandler = this . mcpServer . server [ "_requestHandlers" ] . get ( CallToolRequestSchema . shape . method . value ) ;
3844 this . mcpServer . server . setRequestHandler ( CallToolRequestSchema , ( request , extra ) : Promise < CallToolResult > => {
3945 if ( ! request . params . arguments ) {
You can’t perform that action at this time.
0 commit comments