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

Method discoverServerTools

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

* Discover tools from one server. Cache-aside by default; pass * `forceRefresh: true` from explicit-refresh paths (refresh button, OAuth * callback) to bypass both positive and negative caches. Concurrent callers * for the same `(workspaceId, serverId, userId, forceRefresh)` share one *

(
    userId: string,
    serverId: string,
    workspaceId: string,
    forceRefresh = false
  )

Source from the content-addressed store, hash-verified

605 * upstream request.
606 */
607 async discoverServerTools(
608 userId: string,
609 serverId: string,
610 workspaceId: string,
611 forceRefresh = false
612 ): Promise<McpTool[]> {
613 const inflightKey = `${workspaceId}:${serverId}:${userId}:${forceRefresh ? 'force' : 'cache'}`
614 const existing = this.inflightServerDiscovery.get(inflightKey)
615 if (existing) return existing
616
617 const promise = this.discoverServerToolsImpl(
618 userId,
619 serverId,
620 workspaceId,
621 forceRefresh
622 ).finally(() => {
623 this.inflightServerDiscovery.delete(inflightKey)
624 })
625 this.inflightServerDiscovery.set(inflightKey, promise)
626 return promise
627 }
628
629 private async discoverServerToolsImpl(
630 userId: string,

Callers 5

service.test.tsFile · 0.80
route.tsFile · 0.80
route.tsFile · 0.80
route.tsFile · 0.80
route.tsFile · 0.80

Calls 4

getMethod · 0.65
deleteMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected