{"record":{"id":"cabc6224b9e30b67","repo":"mastra-ai/mastra","slug":"schema-for-tool-toolslug-not-found-in-provider","errorCode":null,"errorMessage":"Schema for tool ${toolSlug} not found in provider ${providerId}","messagePattern":"Schema for tool (.+?) not found in provider (.+?)","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"packages/server/src/server/handlers/tool-providers.ts","lineNumber":247,"sourceCode":"  method: 'GET',\n  path: '/tool-providers/:providerId/tools/:toolSlug/schema',\n  responseType: 'json',\n  pathParamSchema: toolSlugPathParams,\n  responseSchema: getToolProviderToolSchemaResponseSchema,\n  summary: 'Get tool provider tool schema',\n  description: 'Returns the schema for a specific tool from a tool provider',\n  tags: ['Tool Providers'],\n  requiresAuth: true,\n  handler: async ({ mastra, providerId, toolSlug }) => {\n    try {\n      const editor = requireEditor(mastra.getEditor());\n      const provider = await resolveProvider(editor, providerId);\n      if (!provider.getToolSchema) {\n        throw new HTTPException(404, { message: `Tool provider ${providerId} does not support getToolSchema` });\n      }\n      const schema = await provider.getToolSchema(toolSlug);\n      if (!schema) {\n        throw new HTTPException(404, { message: `Schema for tool ${toolSlug} not found in provider ${providerId}` });\n      }\n      return schema;\n    } catch (error) {\n      return handleError(error, 'Error getting tool provider tool schema');\n    }\n  },\n});\n\n/**\n * POST /tool-providers/:providerId/authorize — Start an OAuth flow and persist\n * a `tool_provider_connections` row for label / scope joins.\n */\nexport const AUTHORIZE_TOOL_PROVIDER_ROUTE = createRoute({\n  method: 'POST',\n  path: '/tool-providers/:providerId/authorize',\n  responseType: 'json',\n  pathParamSchema: toolProviderIdPathParams,\n  bodySchema: authorizeToolProviderBodySchema,","sourceCodeStart":229,"sourceCodeEnd":265,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/server/src/server/handlers/tool-providers.ts#L229-L265","documentation":"HTTP 404 thrown when provider.getToolSchema(toolSlug) returns a falsy value — the provider supports schemas but has no schema registered under the requested tool slug. The handler converts the null/undefined result into a 404 naming both the tool and the provider.","triggerScenarios":"GET /api/tool-providers/:providerId/tools/:toolSlug/schema where toolSlug is not present in the provider's schema map (tool-providers.ts:247).","commonSituations":"Typo or outdated toolSlug from a stale playground cache; provider updated and the tool renamed/removed; requesting a tool that belongs to a different provider; case-sensitivity mismatch in slugs.","solutions":["Verify toolSlug against the provider's listTools() output and use the exact slug.","Refresh the tool list from listTools instead of using cached slugs.","Add the missing tool schema to the provider's getToolSchema implementation if the tool should exist.","Check whether the tool belongs to a different registered providerId."],"exampleFix":"// before\nconst schema = await api.getToolSchema('acme', 'send-email-v2');\n// after\nconst tools = await api.listProviderTools('acme');\nconst slug = tools.find(t => t.name === 'Send Email')?.slug; // 'send-email-v3'\nconst schema = slug ? await api.getToolSchema('acme', slug) : null;","handlingStrategy":"validation","validationCode":"const tools = await api.listProviderTools(providerId);\nif (!tools.some(t => t.slug === toolSlug)) {\n  throw new Error(`Tool '${toolSlug}' not offered by provider '${providerId}'`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  return await api.getToolSchema(providerId, toolSlug);\n} catch (e) {\n  if (e.status === 404 && /Schema for tool .* not found/.test(e.message)) return null;\n  throw e;\n}","preventionTips":["Always derive tool slugs from listTools(), never hardcode them.","Invalidate cached tool lists after provider upgrades.","Watch for slug casing/whitespace differences between providers."],"tags":["http-404","tool-providers","schema","lookup-failed"],"backgroundTag":"resource-not-found","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}