{"record":{"id":"3a4ec5b938e0ab92","repo":"CherryHQ/cherry-studio","slug":"no-arguments-provided","errorCode":null,"errorMessage":"No arguments provided","messagePattern":"No arguments provided","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"src/main/ai/mcp/servers/braveSearch.ts","lineNumber":325,"sourceCode":"          tools: {}\n        }\n      }\n    )\n    this.initialize()\n  }\n\n  initialize() {\n    // Tool handlers\n    this.server.setRequestHandler(ListToolsRequestSchema, async () => ({\n      tools: [WEB_SEARCH_TOOL, LOCAL_SEARCH_TOOL]\n    }))\n\n    this.server.setRequestHandler(CallToolRequestSchema, async (request) => {\n      try {\n        const { name, arguments: args } = request.params\n\n        if (!args) {\n          throw new Error('No arguments provided')\n        }\n\n        switch (name) {\n          case 'brave_web_search': {\n            if (!isBraveWebSearchArgs(args)) {\n              throw new Error('Invalid arguments for brave_web_search')\n            }\n            const { query, count = 10 } = args\n            const results = await performWebSearch(this.apiKey, query, count)\n            return {\n              content: [{ type: 'text', text: results }],\n              isError: false\n            }\n          }\n\n          case 'brave_local_search': {\n            if (!isBraveLocalSearchArgs(args)) {\n              throw new Error('Invalid arguments for brave_local_search')","sourceCodeStart":307,"sourceCodeEnd":343,"githubUrl":"https://github.com/CherryHQ/cherry-studio/blob/726446b54cd69ffe51a276638672f6d95ca0768c/src/main/ai/mcp/servers/braveSearch.ts#L307-L343","documentation":"Inside the CallToolRequestSchema handler, if request.params.arguments is falsy (null/undefined) the code throws 'No arguments provided'. MCP clients normally send an arguments object even when empty, so this indicates a malformed or non-conformant client call.","triggerScenarios":"An MCP client invokes brave_web_search or brave_local_search with arguments omitted or explicitly null rather than an empty object. Common with hand-crafted JSON-RPC or buggy LLM tool-call serialization.","commonSituations":"An LLM emits a tool call with no parameters; a test harness sends {arguments: null}; an older MCP client that treats arguments as optional.","solutions":["Ensure the caller always sends arguments as an object — use {} when no fields are needed.","If you control the client, default arguments to {} before sending the CallTool request.","On the server side, coerce missing args to {} before validation if an empty object is meaningful."],"exampleFix":"// before\nconst { name, arguments: args } = request.params\nif (!args) {\n  throw new Error('No arguments provided')\n}\n\n// after — default to empty object, let schema validation surface required-field errors\nconst { name, arguments: args = {} } = request.params","handlingStrategy":"validation","validationCode":"// Coerce missing args to {} so schema validation handles required fields\nfunction normalizeCallArgs(request) {\n  const args = request.params.arguments\n  if (args == null) request.params.arguments = {}\n  else if (typeof args !== 'object' || Array.isArray(args)) {\n    throw new Error('arguments must be an object')\n  }\n  return request\n}","typeGuard":"function isArgsObject(v): v is Record<string, unknown> {\n  return typeof v === 'object' && v !== null && !Array.isArray(v)\n}","tryCatchPattern":"// Always send an object from the client\nconst args = request.params.arguments ?? {}\nif (!isArgsObject(args)) return { content: [{ type: 'text', text: 'arguments must be an object' }], isError: true }","preventionTips":["Always send arguments as an object (use {} when empty).","Default arguments to {} on the client before sending.","Treat a missing-args request as a client bug, not a runtime error."],"tags":["mcp","validation","brave-search","rpc"],"backgroundTag":null,"analyzedSha":"726446b54cd69ffe51a276638672f6d95ca0768c","analyzedAt":"2026-08-12T17:30:37.448Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}