mastra-ai/mastra · error · HTTPException

Tool provider ${providerId} does not support getConnectionSt

Error message

Tool provider ${providerId} does not support getConnectionStatus

What it means

HTTP 400 thrown by the connection-status handler when the provider does not implement the optional getConnectionStatus method. Batch health checks of stored connections are opt-in, so providers lacking the method cannot report connection state.

Source

Thrown at packages/server/src/server/handlers/tool-providers.ts:393

 * POST /tool-providers/:providerId/connection-status — Batch-check connection liveness.
 */
export const TOOL_PROVIDER_CONNECTION_STATUS_ROUTE = createRoute({
  method: 'POST',
  path: '/tool-providers/:providerId/connection-status',
  responseType: 'json',
  pathParamSchema: toolProviderIdPathParams,
  bodySchema: connectionStatusToolProviderBodySchema,
  responseSchema: connectionStatusToolProviderResponseSchema,
  summary: 'Get connection status for a provider',
  description: 'Batch-checks whether a set of (connectionId, toolkit) tuples are still connected',
  tags: ['Tool Providers'],
  requiresAuth: true,
  handler: async ({ mastra, providerId, items }) => {
    try {
      const editor = requireEditor(mastra.getEditor());
      const provider = await resolveProvider(editor, providerId);
      if (!provider.getConnectionStatus) {
        throw new HTTPException(400, { message: `Tool provider ${providerId} does not support getConnectionStatus` });
      }
      const result = await provider.getConnectionStatus({ items });
      return { items: result };
    } catch (error) {
      return handleError(error, 'Error getting connection status');
    }
  },
});

/**
 * GET /tool-providers/:providerId/connections — Existing provider connections
 * scoped to a toolkit. Admin callers can pass `authorId` and `scope` filters;
 * non-admins always see only their own + shared rows.
 */
export const LIST_TOOL_PROVIDER_CONNECTIONS_ROUTE = createRoute({
  method: 'GET',
  path: '/tool-providers/:providerId/connections',
  responseType: 'json',

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Implement getConnectionStatus({ items }) on the ToolProvider and re-register it.
  2. Exclude this provider from status polling in the caller.
  3. Upgrade the provider package to a version implementing getConnectionStatus.
  4. Gate the status UI on a capabilities check per provider.

Example fix

// before
class MyProvider implements ToolProvider { async authorize() { /* ... */ } }
// after
class MyProvider implements ToolProvider {
  async authorize() { /* ... */ }
  async getConnectionStatus({ items }) {
    return items.map(i => ({ connectionId: i.connectionId, status: 'connected' }));
  }
}
Defensive patterns

Strategy: try-catch

Validate before calling

const provider = await api.getProvider(providerId);
if (typeof provider?.getConnectionStatus !== 'function') {
  return { items: [] };
}

Type guard

function supportsGetConnectionStatus(p: ToolProvider): p is ToolProvider & Required<Pick<ToolProvider, 'getConnectionStatus'>> {
  return typeof p.getConnectionStatus === 'function';
}

Try / catch

try {
  return await api.getConnectionStatus(providerId, items);
} catch (e) {
  if (e.status === 400 && /does not support getConnectionStatus/.test(e.message)) return { items: [] };
  throw e;
}

Prevention

When it happens

Trigger: POST /api/tool-providers/:providerId/connection-status with an items list (tool-providers.ts:393) against a provider registered without getConnectionStatus.

Common situations: A monitoring dashboard or UI polls status for all providers uniformly; custom provider only implements authorize/disconnect; provider package version predates getConnectionStatus.

Related errors


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