mastra-ai/mastra · error · Error

No arguments provided

Error message

No arguments provided

What it means

The MCP tool executor `createExecuteFunction` throws this when an LLM client invokes a Firecrawl tool with `args` being null/undefined. Since every Firecrawl operation requires at least a `url` (or an `id` for status checks), the server rejects the call up front rather than passing undefined into the request handlers.

Source

Thrown at packages/mcp/src/__fixtures__/fire-crawl-complex-schema.ts:619

      await delay(delayMs);
      return withRetry(operation, context, attempt + 1);
    }

    throw error;
  }
}
// --- End added back helper functions ---

// Define the tool execution logic creator
const createExecuteFunction = (originalName: string) => async (args: any) => {
  const client = new FirecrawlApp({ apiKey: 'FIXTURE_API_KEY_PLACEHOLDER' });
  const startTime = Date.now();
  try {
    safeLog('info', `[${new Date().toISOString()}] Received request for tool: ${originalName}`);

    if (!args) {
      throw new Error('No arguments provided');
    }

    switch (originalName) {
      case 'firecrawl_scrape': {
        if (!isScrapeOptions(args)) {
          throw new Error('Invalid arguments for firecrawl_scrape');
        }
        const { url, ...options } = args;
        try {
          const scrapeStartTime = Date.now();
          safeLog('info', `Starting scrape for URL: ${url} with options: ${JSON.stringify(options)}`);

          const response = await client.scrapeUrl(url, {
            ...options,
          });

          safeLog('info', `Scrape completed in ${Date.now() - scrapeStartTime}ms`);

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Ensure the MCP client always sends a non-null `arguments` object, even for tools with only optional parameters.
  2. Wrap the tool call site so arguments default to `{}` before invoking the tool.
  3. Re-validate the client's tool-schema negotiation so the model knows required parameters exist.

Example fix

// before
await client.callTool({ name: 'firecrawl_scrape' });
// after
await client.callTool({ name: 'firecrawl_scrape', arguments: { url: 'https://example.com' } });
Defensive patterns

Strategy: validation

Validate before calling

// run before calling the tool
if (args === null || args === undefined || typeof args !== 'object') {
  throw new TypeError('firecrawl tool call requires an arguments object');
}
args = args ?? {};

Type guard

function hasArgs(a: unknown): a is Record<string, unknown> {
  return typeof a === 'object' && a !== null;
}

Try / catch

try {
  const result = await callTool({ name, arguments: args ?? {} });
} catch (e) {
  if ((e as Error).message === 'No arguments provided') {
    // retry with a default empty arguments object or correct payload
  }
}

Prevention

When it happens

Trigger: Calling any firecrawl_* MCP tool with a null/undefined `arguments` payload — e.g. the client sends `{"name":"firecrawl_scrape","arguments":null}` or omits the arguments key entirely.

Common situations: LLM clients that emit empty tool calls, broken prompt/tool-schema negotiation causing the model to omit arguments, custom MCP clients that forget to serialize the arguments object.

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 mastra-ai/mastra@75dd419e61 (2026-08-30). Data as JSON: /api/errors/4220624247ed7ff4. Report an issue: GitHub.