{"record":{"id":"22492c53f6fdd3b7","repo":"mastra-ai/mastra","slug":"api-not-implemented","errorCode":null,"errorMessage":"API not implemented","messagePattern":"API not implemented","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/core/src/integration/openapi-toolset.ts","lineNumber":27,"sourceCode":"\n  authType: string = 'API_KEY';\n\n  constructor() {}\n\n  protected get toolSchemas(): any {\n    return {};\n  }\n\n  protected get toolDocumentations(): Record<string, { comment: string; doc?: string }> {\n    return {};\n  }\n\n  protected get baseClient(): any {\n    return {};\n  }\n\n  async getApiClient(): Promise<any> {\n    throw new Error('API not implemented');\n  }\n\n  protected _generateIntegrationTools<T>() {\n    const { client: _client, ...clientMethods } = this.baseClient;\n    const schemas = this.toolSchemas;\n    const documentations = this.toolDocumentations;\n\n    const tools = Object.keys(clientMethods).reduce((acc, key) => {\n      const comment = documentations[key]?.comment;\n      // const doc = documentations[key]?.doc;\n      const fallbackComment = `Execute ${key}`;\n\n      const tool = createTool({\n        id: key,\n        inputSchema: schemas[key] || z.object({}),\n        description: comment || fallbackComment,\n        // documentation: doc || fallbackComment,\n        execute: async input => {","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/core/src/integration/openapi-toolset.ts#L9-L45","documentation":"OpenAPIToolset's base implementation of getApiClient throws 'API not implemented'. The toolset can generate tools from its schema without a live client (baseClient defaults to {}), but if you ask for an actual API client, only concrete subclasses that bind a real HTTP client can answer. The error marks the unimplemented capability, not a runtime failure.","triggerScenarios":"Calling toolset.getApiClient() (directly or via the client() helper that invokes it) on a plain OpenAPIToolset / base toolset instance that does not override getApiClient with a real client implementation.","commonSituations":"Instantiating a generic OpenAPI toolset from a spec and then trying to obtain its client for custom calls; helper code assuming every toolset exposes getApiClient; subclassing OpenAPIToolset without wiring the generated client.","solutions":["Use a concrete toolset subclass that overrides getApiClient and returns the generated client","If you only need the generated tools, use _generateIntegrationTools output / listTools instead of getApiClient","Construct the API client from the OpenAPI document yourself using the spec you loaded","Extend OpenAPIToolset and override getApiClient to return your bound client"],"exampleFix":"// before\nconst client = await toolset.getApiClient(); // throws\nconst tools = toolset._generateIntegrationTools(); // use generated tools instead\n// after\nclass MyToolset extends OpenAPIToolset {\n  async getApiClient() {\n    return createClient(this.openApiSpec);\n  }\n}\nconst client = await new MyToolset(spec).getApiClient();","handlingStrategy":"fallback","validationCode":"if (toolset.getApiClient === OpenAPIToolset.prototype.getApiClient) {\n  // base toolset has no client; use generated tools instead\n}","typeGuard":"function hasApiToolsetClient(toolset) {\n  return typeof toolset.getApiClient === 'function' &&\n    toolset.getApiClient !== OpenAPIToolset.prototype.getApiClient;\n}","tryCatchPattern":"try {\n  client = await toolset.getApiClient();\n} catch (e) {\n  if (e.message === 'API not implemented') {\n    client = null; // use toolset.listTools() / generated tools instead\n  } else {\n    throw e;\n  }\n}","preventionTips":["Use concrete toolset subclasses that bind a real client","If you only need tools, use the generated integration tools rather than the client","Override getApiClient when subclassing OpenAPIToolset","Check for a client before writing code paths that depend on direct API calls"],"tags":["not-implemented","openapi","toolset","api-client"],"backgroundTag":"method-not-implemented","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}