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

Method WrapToolCall

pkg/middleware/filesystem.go:133–146  ·  view source on GitHub ↗

WrapToolCall 包装工具调用

(ctx context.Context, req *ToolCallRequest, handler ToolCallHandler)

Source from the content-addressed store, hash-verified

131
132// WrapToolCall 包装工具调用
133func (m *FilesystemMiddleware) WrapToolCall(ctx context.Context, req *ToolCallRequest, handler ToolCallHandler) (*ToolCallResponse, error) {
134 // 执行工具调用
135 resp, err := handler(ctx, req)
136 if err != nil {
137 return resp, err
138 }
139
140 // 检查是否需要驱逐大结果
141 if m.enableEviction && m.backend != nil {
142 resp = m.evictLargeResults(ctx, req, resp)
143 }
144
145 return resp, nil
146}
147
148// evictLargeResults 驱逐大结果到文件
149func (m *FilesystemMiddleware) evictLargeResults(ctx context.Context, req *ToolCallRequest, resp *ToolCallResponse) *ToolCallResponse {

Callers

nothing calls this directly

Calls 2

evictLargeResultsMethod · 0.95
handlerFunction · 0.85

Tested by

no test coverage detected