MCPcopy Index your code
hub / github.com/simstudioai/sim / markServerUnhealthy

Method markServerUnhealthy

apps/sim/lib/mcp/service.ts:387–404  ·  view source on GitHub ↗

* Negative-cache a discovery failure. OAuth-required errors are exempt so * reconnects retry immediately.

(
    workspaceId: string,
    serverId: string,
    error: unknown
  )

Source from the content-addressed store, hash-verified

385 * reconnects retry immediately.
386 */
387 private async markServerUnhealthy(
388 workspaceId: string,
389 serverId: string,
390 error: unknown
391 ): Promise<void> {
392 if (error instanceof McpOauthAuthorizationRequiredError || error instanceof UnauthorizedError) {
393 return
394 }
395 try {
396 await this.cacheAdapter.set(
397 failureCacheKey(workspaceId, serverId),
398 FAILURE_CACHE_SENTINEL,
399 MCP_CLIENT_CONSTANTS.FAILURE_CACHE_TTL_MS
400 )
401 } catch (err) {
402 logger.warn(`Failed to write failure cache for server ${serverId}:`, err)
403 }
404 }
405
406 private async isServerUnhealthy(workspaceId: string, serverId: string): Promise<boolean> {
407 try {

Callers 2

discoverToolsMethod · 0.95

Calls 3

failureCacheKeyFunction · 0.85
setMethod · 0.65
warnMethod · 0.65

Tested by

no test coverage detected