Skip to content

Commit b4ae7cc

Browse files
committed
fix: 修改工具处理程序以返回 API 响应消息而不是错误
1 parent 54f080e commit b4ae7cc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

internal/handler/tool_handler.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ func (h *ToolHandler) Handle(ctx context.Context, request mcp.CallToolRequest) (
4949
return nil, fmt.Errorf("unmarshal response failed: %w", err)
5050
}
5151
if baseResp.Code != 200 {
52-
return nil, fmt.Errorf("api response failed:%s", baseResp.Message)
52+
// return nil, fmt.Errorf("api response failed:%s", baseResp.Message)
53+
return mcp.NewToolResultText(baseResp.Message), nil
5354
}
5455

5556
// 只返回 data 部分的数据

0 commit comments

Comments
 (0)