koala73/worldmonitor · error · UsageError

`call` needs a tool name, e.g. `worldmonitor call get_countr

Error message

`call` needs a tool name, e.g. `worldmonitor call get_country_risk --country_code IR`

What it means

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.

Source

Thrown at cli/src/core.mjs:279

  if (command === 'health') {
    return restPlan('/api/health', {}, options, config);
  }
  if (command === 'get') {
    const path = positionals[0];
    if (!path || !path.startsWith('/')) {
      throw new UsageError('`get` needs an API path, e.g. `worldmonitor get /api/health`');
    }
    return restPlan(path, params, options, config);
  }

  if (command === 'tools') return mcpPlan('tools/list', undefined, options, config);
  if (command === 'prompts') return mcpPlan('prompts/list', undefined, options, config);
  if (command === 'resources') return mcpPlan('resources/list', undefined, options, config);

  if (command === 'call') {
    const tool = positionals[0];
    if (!tool) {
      throw new UsageError(
        '`call` needs a tool name, e.g. `worldmonitor call get_country_risk --country_code IR`',
      );
    }
    return mcpPlan('tools/call', { name: tool, arguments: collectArgs(parsed) }, options, config, {
      needsKey: true,
    });
  }

  if (Object.hasOwn(CURATED_COMMANDS, command)) {
    const spec = CURATED_COMMANDS[command];
    const args = {};
    for (const [k, v] of Object.entries(params)) args[k] = v === true ? true : String(v);
    spec.args.forEach((a, idx) => {
      if (positionals[idx] !== undefined) args[a.name] = positionals[idx];
    });
    for (const a of spec.args) {
      if (a.required && args[a.name] === undefined) {
        throw new UsageError(`\`${command}\` needs <${a.name}>. Usage: worldmonitor ${command} <${a.name}>`);

View on GitHub (pinned to eeab0a219f)

Solutions

  1. Put the tool name first: worldmonitor call get_country_risk --country_code IR
  2. List available tool names with `worldmonitor tools` and copy the exact identifier

Example fix

# before
worldmonitor call --country_code IR   # UsageError: `call` needs a tool name

# after
worldmonitor call get_country_risk --country_code IR
Defensive patterns

Strategy: validation

Validate before calling

// Confirm the tool exists before constructing the call
const tools = (await run(['tools'], io)).stdout;   // or a cached tools/list
if (!tools.includes(toolName)) throw new Error(`Unknown tool: ${toolName}`);

Prevention

When it happens

Trigger: `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.

Common situations: Trimming a copied example and deleting the tool name; assuming the CLI will prompt interactively for the tool.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of koala73/worldmonitor@eeab0a219f (2026-08-21). Data as JSON: /api/errors/bc4ec2099773a8a5. Report an issue: GitHub.