Skip to content

Commit 0113a78

Browse files
authored
Revert "Fix tool call return type to parse as JSON before returning (#66)" (#67)
This reverts commit 36e2c84.
1 parent 36e2c84 commit 0113a78

File tree

3 files changed

+3
-12
lines changed

3 files changed

+3
-12
lines changed

internal/api/servers.go

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package api
22

33
import (
44
"context"
5-
"encoding/json"
65
"fmt"
76
"net/http"
87
"slices"
@@ -163,16 +162,8 @@ func handleServerToolCall(accessor contracts.MCPClientAccessor, server string, t
163162
return nil, fmt.Errorf("%w: %s/%s: %v", errors.ErrToolCallFailedUnknown, server, tool, extractMessage(result.Content))
164163
}
165164

166-
// Parse the response content of the tool, ensure we can translate the message as JSON.
167-
msg := extractMessage(result.Content)
168-
var respData map[string]any
169-
err = json.Unmarshal([]byte(msg), &respData)
170-
if err != nil {
171-
return nil, fmt.Errorf("%w: %s/%s: error parsing response: %s: %w", errors.ErrToolCallFailedUnknown, server, tool, msg, err)
172-
}
173-
174165
resp := &ToolCallResponse{}
175-
resp.Body = respData
166+
resp.Body = extractMessage(result.Content)
176167

177168
return resp, nil
178169
}

internal/api/tools.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ type ToolsResponse struct {
1616

1717
// ToolCallResponse represents the wrapped API response for calling a tool.
1818
type ToolCallResponse struct {
19-
Body map[string]any
19+
Body string
2020
}
2121

2222
// Tool represents a callable tool, following the MCP spec.

internal/runtime/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func AggregateConfigs(
5454
}
5555

5656
func (s *Server) Environ() []string {
57-
baseEnvs := os.Environ() // TODO: Only 'add' required/configured env vars for this server's binary.
57+
baseEnvs := os.Environ()
5858
overrideEnvs := make([]string, 0, len(s.Env))
5959
for k, v := range s.Env {
6060
overrideEnvs = append(overrideEnvs, fmt.Sprintf("%s=%s", k, v))

0 commit comments

Comments
 (0)