MCPcopy Create free account
hub / github.com/simstudioai/sim / fetchMcpTools

Function fetchMcpTools

apps/sim/hooks/queries/mcp.ts:99–121  ·  view source on GitHub ↗
(
  workspaceId: string,
  forceRefresh = false,
  signal?: AbortSignal,
  serverId?: string
)

Source from the content-addressed store, hash-verified

97}
98
99async function fetchMcpTools(
100 workspaceId: string,
101 forceRefresh = false,
102 signal?: AbortSignal,
103 serverId?: string
104): Promise<McpTool[]> {
105 try {
106 const data = await requestJson(discoverMcpToolsContract, {
107 query: {
108 workspaceId,
109 refresh: forceRefresh || undefined,
110 ...(serverId ? { serverId } : {}),
111 },
112 signal,
113 })
114 return data.data.tools
115 } catch (error) {
116 if (error instanceof ApiClientError && error.status === 404) {
117 return []
118 }
119 throw error
120 }
121}
122
123/**
124 * Workspace aggregate derived from N parallel per-server queries via

Callers 2

useMcpToolsQueryFunction · 0.85
useForceRefreshMcpToolsFunction · 0.85

Calls 1

requestJsonFunction · 0.90

Tested by

no test coverage detected