{"record":{"id":"281a0bdcb44726c5","repo":"eyaltoledano/claude-task-master","slug":"missing-argument-281a0b","errorCode":"MISSING_ARGUMENT","errorMessage":"tasksJsonPath is required","messagePattern":"tasksJsonPath is required","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"mcp-server/src/core/direct-functions/use-tag.js","lineNumber":43,"sourceCode":"\t// Destructure expected args\n\tconst { tasksJsonPath, name, projectRoot } = args;\n\tconst { session } = 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 if tasksJsonPath was provided\n\t\tif (!tasksJsonPath) {\n\t\t\tlog.error('useTagDirect called without tasksJsonPath');\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_ARGUMENT',\n\t\t\t\t\tmessage: 'tasksJsonPath is required'\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\n\t\t// Check required parameters\n\t\tif (!name || typeof name !== 'string') {\n\t\t\tlog.error('Missing required parameter: name');\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: 'Tag name is required and must be a string'\n\t\t\t\t}\n\t\t\t};\n\t\t}\n","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/mcp-server/src/core/direct-functions/use-tag.js#L25-L61","documentation":"useTagDirect is the MCP direct-function wrapper for switching the active task tag. Before doing any work it requires the absolute path to the tasks.json file; if the caller omits tasksJsonPath it fails fast with MISSING_ARGUMENT so no tag operations run against an unknown file.","triggerScenarios":"Calling the use-tag MCP tool (or useTagDirect directly) without a tasksJsonPath argument, e.g. the tool handler forgot to resolve the workspace root into a tasks.json path before invoking this function.","commonSituations":"MCP client omits the optional-looking argument; a tool registration passes args through without defaulting tasksJsonPath from the session/project root; automated scripts calling the direct function API with only a tag name.","solutions":["Pass tasksJsonPath (absolute path to tasks.json) in the tool call arguments","In the MCP tool registration, default tasksJsonPath from the project root if the client omits it","Log the received arguments at the tool layer to confirm which parameter name the client is actually sending"],"exampleFix":"// before\nawait useTagDirect({ name: 'feature' });\n// after\nawait useTagDirect({ name: 'feature', tasksJsonPath: '/path/to/project/.taskmaster/tasks.json' });","handlingStrategy":"validation","validationCode":"function assertTasksJsonPath(args) {\n  if (!args?.tasksJsonPath || typeof args.tasksJsonPath !== 'string') {\n    throw new Error('tasksJsonPath is required (absolute path to tasks.json)');\n  }\n}","typeGuard":"function hasTasksJsonPath(a): a is { tasksJsonPath: string } & Record<string, unknown> {\n  return typeof a === 'object' && a !== null && typeof (a as any).tasksJsonPath === 'string' && (a as any).tasksJsonPath.length > 0;\n}","tryCatchPattern":"try {\n  const res = await useTagDirect(args);\n  if (!res.success && res.error?.code === 'MISSING_ARGUMENT') {\n    // resolve and retry with explicit path\n  }\n} catch (e) { /* handle */ }","preventionTips":["Always pass an absolute tasksJsonPath resolved from the project root","Validate tool arguments against the tool's input schema client-side","Default tasksJsonPath in your MCP tool wrapper"],"tags":["mcp","missing-argument","validation"],"backgroundTag":"missing-required-argument","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}