different-ai/openwork · error · ExternalMcpDiagnosticError

Reduce or repair the provider MCP catalog or resource to sat

Error message

Reduce or repair the provider MCP catalog or resource to satisfy the named enterprise client limit.

What it means

`runEnterpriseMcpOperation` wraps every external MCP client operation in the Den gateway; any error thrown by the wrapped operation is funneled through `translateEnterpriseMcpError`, which converts low-level MCP/transport faults into operator-facing messages. This message means the provider's MCP catalog or resource violates a named enterprise client limit (e.g. catalog size, tool count, schema constraints) and the connection or tool operation was refused.

Source

Thrown at ee/apps/den-api/src/capability-sources/enterprise-mcp-client-adapter.ts:248

        },
      } : {}),
    }),
  }
}

async function runEnterpriseMcpOperation<T>(input: {
  connection: ExternalMcpConnectionRow
  diagnosticReferenceId?: string
  lifecycleDeadline?: ExternalMcpLifecycleDeadline
  operationTimeoutMs?: number
  toolCallInspector?: ExternalMcpToolCallInspector
  operation: (client: EnterpriseMcpClient) => Promise<T>
}): Promise<T> {
  const { client, tracker } = createOperationClient(input)
  try {
    return await input.operation(client)
  } catch (error) {
    throw translateEnterpriseMcpError(error, tracker)
  }
}

export async function connectExternalMcp(
  connection: ExternalMcpConnectionRow,
  redirectUri: string,
  signedState?: string,
  member?: ExternalMcpMemberContext,
  diagnosticReferenceId?: string,
): Promise<ExternalMcpConnectResult> {
  return runEnterpriseMcpOperation({
    connection,
    diagnosticReferenceId,
    operation: (client) => client.connect({
      connection: toEnterpriseConnection(connection, member),
      redirectUri,
      authorizationId: signedState,
    }),

View on GitHub (pinned to 2b7df46e8a)

Solutions

  1. Read the named limit in the translated error and reduce the provider's catalog/resource accordingly (remove tools, shrink schemas)
  2. Use a scoped MCP server that exposes only the needed tools instead of the full catalog
  3. If you administer the provider, split the server into multiple smaller MCP endpoints and connect the relevant one
  4. Check the diagnostic tracker output for the exact phase and limit to target the fix

Example fix

// before
await connectExternalMcp(conn, redirectUri) // provider exposes 500 tools -> limit violation
// after
// point the connection at a scoped server exposing only required tools
const scopedConn = { ...conn, url: "https://mcp.example.com/scoped" };
await connectExternalMcp(scopedConn, redirectUri);
Defensive patterns

Strategy: try-catch

Validate before calling

// before connecting, verify the provider catalog fits limits
const tools = await probeProviderTools(conn.url);
if (tools.length > ENTERPRISE_MCP_ITEM_LIMIT) throw new Error("catalog too large; use scoped server");

Type guard

function isEnterpriseMcpLimitError(e: unknown): boolean {
  return e instanceof Error && /enterprise client limit/i.test(e.message);
}

Try / catch

try {
  await connectExternalMcp(conn, redirectUri);
} catch (e) {
  if (isEnterpriseMcpLimitError(e)) {
    logDiagnostic(tracker.phase, e.message); // tells you which limit and phase
  } else throw e;
}

Prevention

When it happens

Trigger: Any of connectExternalMcp, completeExternalMcpAuth, abandonExternalMcpAuth, listExternalMcpTools, runExternalMcpToolCall, or callExternalMcpToolRaw invokes an operation whose client returns an error that translates to an enterprise client limit violation; the tracker annotates which phase (connect/auth/discovery/call) failed.

Common situations: Connecting a third-party MCP server whose tool catalog exceeds enterprise limits; a provider updated its server adding tools/resources that breach limits; OAuth completion succeeding but catalog validation failing during initial discovery.

Related errors


AI-assisted analysis of different-ai/openwork@2b7df46e8a (2026-09-01). Data as JSON: /api/errors/39f7c6209a839173. Report an issue: GitHub.