{"record":{"id":"aedae4583dec1f33","repo":"mastra-ai/mastra","slug":"invalid-arguments-for-firecrawl-map","errorCode":null,"errorMessage":"Invalid arguments for firecrawl_map","messagePattern":"Invalid arguments for firecrawl_map","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/mcp/src/__fixtures__/fire-crawl-complex-schema.ts","lineNumber":691,"sourceCode":"              {\n                type: 'text',\n                text: trimResponseText(contentParts.join('\\n\\n') || 'No content available'),\n              },\n            ],\n            isError: false,\n          };\n        } catch (error) {\n          const errorMessage = error instanceof Error ? error.message : String(error);\n          return {\n            content: [{ type: 'text', text: trimResponseText(errorMessage) }],\n            isError: true,\n          };\n        }\n      }\n\n      case 'firecrawl_map': {\n        if (!isMapOptions(args)) {\n          throw new Error('Invalid arguments for firecrawl_map');\n        }\n        const { url, ...options } = args;\n        const response = await client.mapUrl(url, {\n          ...options,\n        });\n        if ('error' in response) {\n          throw new Error(response.error);\n        }\n        if (!response.links) {\n          throw new Error('No links received from Firecrawl API');\n        }\n        return {\n          content: [{ type: 'text', text: trimResponseText(response.links.join('\\n')) }],\n          isError: false,\n        };\n      }\n\n      case 'firecrawl_crawl': {","sourceCodeStart":673,"sourceCodeEnd":709,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/mcp/src/__fixtures__/fire-crawl-complex-schema.ts#L673-L709","documentation":"The firecrawl_map branch validates args with `isMapOptions`, which requires an object with a string `url`. A failed guard throws this before `client.mapUrl` is called.","triggerScenarios":"Calling firecrawl_map without a `url` property, with a non-string url, or with a non-object payload — e.g. `{\"arguments\":{}}` or `{\"arguments\":{\"url\":null}}`.","commonSituations":"The model confuses firecrawl_map's single `url` (site root to enumerate) with a search `query`, or omits arguments while trying to 'list links'.","solutions":["Include a string `url` (the site root to map) in the arguments.","Fix mismatched key names to exactly `url`.","Validate the payload client-side before dispatching the tool call."],"exampleFix":"// before\nfirecrawl_map({ 'query': 'example.com' })\n// after\nfirecrawl_map({ 'url': 'https://example.com' })","handlingStrategy":"type-guard","validationCode":"if (!args || typeof args.url !== 'string') {\n  throw new TypeError('firecrawl_map requires { url: string }');\n}","typeGuard":"function isMapOptions(a: unknown): a is { url: string } & Record<string, unknown> {\n  return typeof a === 'object' && a !== null && 'url' in a && typeof (a as { url: unknown }).url === 'string';\n}","tryCatchPattern":"try {\n  await callTool({ name: 'firecrawl_map', arguments: { url } });\n} catch (e) {\n  if ((e as Error).message === 'Invalid arguments for firecrawl_map') {\n    // re-send with a corrected { url: string } payload\n  }\n}","preventionTips":["Pass the site root URL to map, not a search query.","Run the same isMapOptions guard in the client before dispatching.","Keep the tool inputSchema and client payload construction in sync after upgrades."],"tags":["mcp","validation","type-guard"],"backgroundTag":"invalid-tool-arguments","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}