{"record":{"id":"b8ec5c1936fda280","repo":"mastra-ai/mastra","slug":"invalid-arguments-for-firecrawl-generate-llmstxt","errorCode":null,"errorMessage":"Invalid arguments for firecrawl_generate_llmstxt","messagePattern":"Invalid arguments for firecrawl_generate_llmstxt","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/mcp/src/__fixtures__/fire-crawl-complex-schema.ts","lineNumber":897,"sourceCode":"              {\n                type: 'text',\n                text: trimResponseText(formattedResponse.finalAnalysis),\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_generate_llmstxt': {\n        if (!isGenerateLLMsTextOptions(args)) {\n          throw new Error('Invalid arguments for firecrawl_generate_llmstxt');\n        }\n\n        try {\n          const { url, ...params } = args;\n          const generateStartTime = Date.now();\n\n          safeLog('info', `Starting LLMs.txt generation for URL: ${url}`);\n\n          const response = await withRetry(\n            async () => client.generateLLMsText(url, { ...params }),\n            'LLMs.txt generation',\n          );\n\n          if (!response.success) {\n            throw new Error(response.error || 'LLMs.txt generation failed');\n          }\n\n          safeLog('info', `LLMs.txt generation completed in ${Date.now() - generateStartTime}ms`);","sourceCodeStart":879,"sourceCodeEnd":915,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/mcp/src/__fixtures__/fire-crawl-complex-schema.ts#L879-L915","documentation":"firecrawl_generate_llmstxt validates args with isGenerateLLMsTextOptions(args) before calling client.generateLLMsText. The guard requires a valid `url` plus allowed optional fields (maxUrls, showFullText, etc.); failure throws this error pre-flight. It protects the expensive LLMs.txt generation job from malformed input.","triggerScenarios":"args fails isGenerateLLMsTextOptions: url missing or not a valid http(s) string, maxUrls not a positive number, showFullText not boolean, or extra/mistyped fields present.","commonSituations":"Passing a domain without scheme (example.com instead of https://example.com); LLM client omitting url and passing only options; maxUrls sent as a string; schema drift after tool-definition updates.","solutions":["Pass a complete http(s) URL in the `url` field, e.g. https://example.com.","Type optional params correctly: maxUrls as a number, showFullText as a boolean.","Cross-check arguments against the firecrawl_generate_llmstxt Zod schema in the server.","Validate/normalize the URL client-side (new URL(...)) before invoking the tool."],"exampleFix":"// before\nfirecrawl_generate_llmstxt({ url: \"example.com\", maxUrls: \"100\" })\n// after\nfirecrawl_generate_llmstxt({ url: \"https://example.com\", maxUrls: 100 })","handlingStrategy":"validation","validationCode":"function canGenerateLlmsTxt(args) {\n  if (!args || typeof args.url !== 'string') return false;\n  try {\n    const p = new URL(args.url);\n    if (p.protocol !== 'http:' && p.protocol !== 'https:') return false;\n  } catch { return false; }\n  if (args.maxUrls !== undefined && (typeof args.maxUrls !== 'number' || args.maxUrls <= 0)) return false;\n  if (args.showFullText !== undefined && typeof args.showFullText !== 'boolean') return false;\n  return true;\n}","typeGuard":"function isGenerateLlmsTxtArgs(a: unknown): a is { url: string; maxUrls?: number; showFullText?: boolean } {\n  if (typeof a !== 'object' || a === null) return false;\n  const o = a as Record<string, unknown>;\n  return typeof o.url === 'string' && /^https?:\\/\\//.test(o.url) &&\n    (o.maxUrls === undefined || typeof o.maxUrls === 'number') &&\n    (o.showFullText === undefined || typeof o.showFullText === 'boolean');\n}","tryCatchPattern":"try {\n  return await generateLlmsTxt(args);\n} catch (e) {\n  if (e instanceof Error && e.message.startsWith('Invalid arguments for firecrawl_generate_llmstxt')) {\n    // auto-fix scheme-less URLs\n    if (typeof args?.url === 'string' && !/^https?:\\/\\//.test(args.url)) {\n      return generateLlmsTxt({ ...args, url: 'https://' + args.url });\n    }\n    throw new TypeError('generate_llmstxt needs { url: absolute http(s) URL }');\n  }\n  throw e;\n}","preventionTips":["Normalize URLs to include the https:// scheme before calling.","Type optional fields strictly (maxUrls: number, showFullText: boolean).","Run args through the tool's Zod schema client-side before execution.","Regenerate typed clients after tool schema updates."],"tags":["mcp","validation","tool-arguments","firecrawl"],"backgroundTag":"invalid-tool-arguments","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}