{"record":{"id":"b2eabe1bcb5281ca","repo":"eyaltoledano/claude-task-master","slug":"missing-parameter-b2eabe","errorCode":"MISSING_PARAMETER","errorMessage":"The query parameter is required and must be a non-empty string","messagePattern":"The query parameter is required and must be a non-empty string","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"mcp-server/src/core/direct-functions/research.js","lineNumber":62,"sourceCode":"\t\ttag\n\t} = args;\n\tconst { session } = context; // Destructure session from context\n\n\t// Enable silent mode to prevent console logs from interfering with JSON response\n\tenableSilentMode();\n\n\t// Create logger wrapper using the utility\n\tconst mcpLog = createLogWrapper(log);\n\n\ttry {\n\t\t// Check required parameters\n\t\tif (!query || typeof query !== 'string' || query.trim().length === 0) {\n\t\t\tlog.error('Missing or invalid required parameter: query');\n\t\t\tdisableSilentMode();\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: 'MISSING_PARAMETER',\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t'The query parameter is required and must be a non-empty string'\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\n\t\t// Parse comma-separated task IDs if provided\n\t\tconst parsedTaskIds = taskIds\n\t\t\t? taskIds\n\t\t\t\t\t.split(',')\n\t\t\t\t\t.map((id) => id.trim())\n\t\t\t\t\t.filter((id) => id.length > 0)\n\t\t\t: [];\n\n\t\t// Parse comma-separated file paths if provided\n\t\tconst parsedFilePaths = filePaths\n\t\t\t? filePaths\n\t\t\t\t\t.split(',')","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/mcp-server/src/core/direct-functions/research.js#L44-L80","documentation":"researchDirect performs an AI-powered research query and requires a `query` string. If query is missing, not a string, or empty/whitespace-only, the function disables silent mode and returns MISSING_PARAMETER before any network or provider call is made.","triggerScenarios":"Calling the research MCP tool with no query, query: '', query: '   ', or a non-string (e.g. an object of options instead of the question text); option fields accidentally placed at top level while query itself was omitted.","commonSituations":"Agents that send only filters (filePaths, detailLevel) but forget the actual question; form UIs submitting before the textarea is filled; query built from a variable that resolved to empty; JSON serialization dropping the field.","solutions":["Pass a non-empty question string, e.g. query: 'How does the auth middleware handle expired tokens?'","Trim the input and check length > 0 in the client before calling","Verify the question text is in the `query` field, not nested inside another options object","If building queries dynamically, add a fallback prompt or re-prompt the user when the variable is empty"],"exampleFix":"// before\nawait client.callTool('research', { detailLevel: 'medium' });\n\n// after\nawait client.callTool('research', { query: 'Explain the retry logic in the API client', detailLevel: 'medium', projectRoot: '/project' });","handlingStrategy":"validation","validationCode":"if (typeof query !== 'string' || query.trim().length === 0) {\n  throw new Error('research requires a non-empty query string');\n}","typeGuard":"function isNonEmptyQuery(args) {\n  return typeof args === 'object' && args !== null &&\n    typeof args.query === 'string' && args.query.trim().length > 0;\n}","tryCatchPattern":"try {\n  const res = await client.callTool('research', { query, detailLevel, projectRoot });\n  if (res.error?.code === 'MISSING_PARAMETER') {\n    console.error('research needs the actual question text in `query`');\n  }\n} catch (e) {\n  console.error('research failed:', e.message);\n}","preventionTips":["Trim and check query.length > 0 before every research call","Keep the question in `query`; put options (detailLevel, filePaths) in their own fields","For agent workflows, re-prompt when the question variable resolves empty","Disable/omit the tool call entirely when there is no question to ask"],"tags":["mcp","validation","missing-parameter"],"backgroundTag":"missing-required-parameter","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}