mastra-ai/mastra · error

Method not implemented.

Error message

Method not implemented.

What it means

listStaticTools is a base-class stub on MastraIntegration. The abstract base intentionally provides no default implementation: each concrete integration (OpenAPI toolset, etc.) must override it. Calling it on the base class or on an integration that has not implemented it throws 'Method not implemented.'

Source

Thrown at packages/core/src/integration/integration.ts:41

  public listWorkflows({ serialized }: { serialized?: boolean }): Record<string, Workflow> {
    if (serialized) {
      return Object.entries(this.workflows).reduce((acc, [k, v]) => {
        return {
          ...acc,
          [k]: {
            name: v.name,
          },
        };
      }, {});
    }
    return this.workflows;
  }

  /**
   * TOOLS
   */
  listStaticTools(_params?: ToolsParams): Record<string, ToolAction<any, any, any>> {
    throw new Error('Method not implemented.');
  }

  async listTools(_params?: ToolsParams): Promise<Record<string, ToolAction<any, any, any>>> {
    throw new Error('Method not implemented.');
  }

  async getApiClient(): Promise<ApiClient> {
    throw new Error('Method not implemented');
  }
}

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Implement listStaticTools in your integration subclass, returning the static tool map
  2. Check hasOwnProperty/listStaticTools availability (e.g. this.listStaticTools !== MastraIntegration.prototype.listStaticTools) before calling
  3. Use listTools() instead if dynamic tools are what you need and the integration supports it
  4. Wrap calls in try/catch when iterating heterogeneous integrations

Example fix

// before
class MyIntegration extends MastraIntegration {}
// after
class MyIntegration extends MastraIntegration {
  listStaticTools(_params?: ToolsParams) {
    return { myTool };
  }
}
Defensive patterns

Strategy: type-guard

Validate before calling

if (integration.listStaticTools === MastraIntegration.prototype.listStaticTools) {
  throw new Error(`${integration.name} does not implement listStaticTools`);
}

Type guard

function implementsListStaticTools(integration) {
  return typeof integration.listStaticTools === 'function' &&
    integration.listStaticTools !== MastraIntegration.prototype.listStaticTools;
}

Try / catch

try {
  const tools = integration.listStaticTools(params);
} catch (e) {
  if (e.message === 'Method not implemented.') {
    const tools = {}; // integration exposes no static tools
  } else {
    throw e;
  }
}

Prevention

When it happens

Trigger: Calling integration.listStaticTools() on an integration subclass that does not override listStaticTools — most commonly the base MastraIntegration class itself, or a custom integration that only implemented listTools/getApiClient.

Common situations: Building a custom integration and forgetting to override listStaticTools; generic tool-enumeration code iterating all integrations and calling listStaticTools unconditionally; calling the method on a base-typed reference.

Related errors


AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30). Data as JSON: /api/errors/0a6a4f827f49496a. Report an issue: GitHub.