MCPcopy Create free account
hub / github.com/ecomfe/tempad-dev / createToolErrorResponse

Function createToolErrorResponse

packages/mcp-server/src/tools.ts:179–194  ·  view source on GitHub ↗
(toolName: string, error: unknown)

Source from the content-addressed store, hash-verified

177 return 'Unknown error occurred.'
178}
179
180function createToolErrorResponse(toolName: string, error: unknown): CallToolResult {
181 const message = extractToolErrorMessage(error)
182 const code = extractToolErrorCode(error)
183 const codeLabel = code ? ` [${code}]` : ''
184 const troubleshooting = buildTroubleshootingText(code, message)
185
186 return {
187 isError: true,
188 content: [
189 {
190 type: 'text' as const,
191 text: `Tool "${toolName}" failed${codeLabel}: ${message}${troubleshooting}`
192 }
193 ]
194 }
195}
196
197function buildTroubleshootingText(code: TempadMcpErrorCode | undefined, message: string): string {

Callers 3

handlerFunction · 0.90
registerHandlerFunction · 0.90
tools.test.tsFile · 0.90

Calls 3

extractToolErrorMessageFunction · 0.85
extractToolErrorCodeFunction · 0.85
buildTroubleshootingTextFunction · 0.85

Tested by

no test coverage detected