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

Method listTools

apps/sim/lib/mcp/client.ts:152–178  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

150 }
151
152 async listTools(): Promise<McpTool[]> {
153 if (!this.isConnected) {
154 throw new McpConnectionError('Not connected to server', this.config.name)
155 }
156
157 try {
158 const result: ListToolsResult = await this.client.listTools(undefined, {
159 timeout: MCP_CLIENT_CONSTANTS.LIST_TOOLS_TIMEOUT_MS,
160 })
161
162 if (!result.tools || !Array.isArray(result.tools)) {
163 logger.warn(`Invalid tools response from server ${this.config.name}:`, result)
164 return []
165 }
166
167 return result.tools.map((tool: Tool) => ({
168 name: tool.name,
169 description: tool.description,
170 inputSchema: tool.inputSchema as McpTool['inputSchema'],
171 serverId: this.config.id,
172 serverName: this.config.name,
173 }))
174 } catch (error) {
175 logger.error(`Failed to list tools from server ${this.config.name}:`, error)
176 throw error
177 }
178 }
179
180 async callTool(toolCall: McpToolCall): Promise<McpToolResult> {
181 if (!this.isConnected) {

Callers 4

discoverToolsMethod · 0.80
getServerSummariesMethod · 0.80
route.tsFile · 0.80

Calls 2

errorMethod · 0.80
warnMethod · 0.65

Tested by

no test coverage detected