MCPcopy Create free account
hub / github.com/astercloud/aster / CallToolJSON

Method CallToolJSON

pkg/tools/bridge/bridge.go:90–101  ·  view source on GitHub ↗

CallToolJSON 使用 JSON 字符串调用工具

(ctx context.Context, name string, inputJSON string, tc *tools.ToolContext)

Source from the content-addressed store, hash-verified

88
89// CallToolJSON 使用 JSON 字符串调用工具
90func (b *ToolBridge) CallToolJSON(ctx context.Context, name string, inputJSON string, tc *tools.ToolContext) (*CallToolResult, error) {
91 var input map[string]any
92 if err := json.Unmarshal([]byte(inputJSON), &input); err != nil {
93 return &CallToolResult{
94 Name: name,
95 Success: false,
96 Error: fmt.Sprintf("invalid JSON input: %v", err),
97 }, nil
98 }
99
100 return b.CallTool(ctx, name, input, tc)
101}
102
103// BatchCallResult 批量调用结果
104type BatchCallResult struct {

Calls 1

CallToolMethod · 0.95