mirror of
https://github.com/Effect-TS/effect.git
synced 2026-12-03 03:25:40 +08:00
improve mcp errors
This commit is contained in:
@@ -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
|
||||
})
|
||||
)
|
||||
|
||||
@@ -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) =>
|
||||
|
||||
Reference in New Issue
Block a user