{"record":{"id":"bc4ec2099773a8a5","repo":"koala73/worldmonitor","slug":"call-needs-a-tool-name-e-g-worldmonitor-call","errorCode":null,"errorMessage":"`call` needs a tool name, e.g. `worldmonitor call get_country_risk --country_code IR`","messagePattern":"`call` needs a tool name, e\\.g\\. `worldmonitor call get_country_risk --country_code IR`","errorType":"exception","errorClass":"UsageError","httpStatus":null,"severity":"error","filePath":"cli/src/core.mjs","lineNumber":279,"sourceCode":"  if (command === 'health') {\n    return restPlan('/api/health', {}, options, config);\n  }\n  if (command === 'get') {\n    const path = positionals[0];\n    if (!path || !path.startsWith('/')) {\n      throw new UsageError('`get` needs an API path, e.g. `worldmonitor get /api/health`');\n    }\n    return restPlan(path, params, options, config);\n  }\n\n  if (command === 'tools') return mcpPlan('tools/list', undefined, options, config);\n  if (command === 'prompts') return mcpPlan('prompts/list', undefined, options, config);\n  if (command === 'resources') return mcpPlan('resources/list', undefined, options, config);\n\n  if (command === 'call') {\n    const tool = positionals[0];\n    if (!tool) {\n      throw new UsageError(\n        '`call` needs a tool name, e.g. `worldmonitor call get_country_risk --country_code IR`',\n      );\n    }\n    return mcpPlan('tools/call', { name: tool, arguments: collectArgs(parsed) }, options, config, {\n      needsKey: true,\n    });\n  }\n\n  if (Object.hasOwn(CURATED_COMMANDS, command)) {\n    const spec = CURATED_COMMANDS[command];\n    const args = {};\n    for (const [k, v] of Object.entries(params)) args[k] = v === true ? true : String(v);\n    spec.args.forEach((a, idx) => {\n      if (positionals[idx] !== undefined) args[a.name] = positionals[idx];\n    });\n    for (const a of spec.args) {\n      if (a.required && args[a.name] === undefined) {\n        throw new UsageError(`\\`${command}\\` needs <${a.name}>. Usage: worldmonitor ${command} <${a.name}>`);","sourceCodeStart":261,"sourceCodeEnd":297,"githubUrl":"https://github.com/koala73/worldmonitor/blob/eeab0a219fce0f02a00603b532dbae9041b934ac/cli/src/core.mjs#L261-L297","documentation":"The `call` command maps to MCP tools/call and the tool name must be the first positional. When it is absent (only flags given, or a value flag swallowed the slot) planRequest raises this UsageError before any network call; the CLI exits with code 2.","triggerScenarios":"`worldmonitor call --country_code IR` (tool name forgotten); `worldmonitor call` with nothing; argument order rearranged so an option value lands in the tool-name position.","commonSituations":"Trimming a copied example and deleting the tool name; assuming the CLI will prompt interactively for the tool.","solutions":["Put the tool name first: worldmonitor call get_country_risk --country_code IR","List available tool names with `worldmonitor tools` and copy the exact identifier"],"exampleFix":"# before\nworldmonitor call --country_code IR   # UsageError: `call` needs a tool name\n\n# after\nworldmonitor call get_country_risk --country_code IR","handlingStrategy":"validation","validationCode":"// Confirm the tool exists before constructing the call\nconst tools = (await run(['tools'], io)).stdout;   // or a cached tools/list\nif (!tools.includes(toolName)) throw new Error(`Unknown tool: ${toolName}`);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Script against tools/list output instead of hardcoding tool names","Re-check tool names after upgrading the MCP server"],"tags":["cli","usage","mcp","arguments"],"backgroundTag":"missing-required-argument","analyzedSha":"eeab0a219fce0f02a00603b532dbae9041b934ac","analyzedAt":"2026-08-21T16:51:25.751Z","schemaVersion":2},"datasetVersion":"2026-08-23T16:17:53.355Z"}