improve mcp errors

This commit is contained in:
Tim Smart
2025-10-07 08:57:04 +13:00
parent 6c9dcabe34
commit 48ec8a5fa6
2 changed files with 4 additions and 5 deletions
+1 -1
View File
@@ -161,7 +161,7 @@ const Proto = {
new AiError({
module: "AiToolkit",
method: `${toolName}.handle`,
description: `Failed to decode tool call parameters for tool '${toolName}' from '${toolParams}'`,
description: `Failed to decode tool call parameters for tool '${toolName}'`,
cause
})
)
+3 -4
View File
@@ -577,14 +577,13 @@ export const registerToolkit: <Tools extends AiTool.Any>(toolkit: AiToolkit.AiTo
handle(payload) {
return built.handle(tool.name as any, payload).pipe(
Effect.provideServices(services as ServiceMap.ServiceMap<any>),
Effect.match({
onFailure: (error) =>
Effect.matchCause({
onFailure: (cause) =>
new CallToolResult({
isError: true,
structuredContent: typeof error === "object" ? error : undefined,
content: [{
type: "text",
text: JSON.stringify(error)
text: Cause.pretty(cause)
}]
}),
onSuccess: (result: any) =>