Skip to content

Commit 0081a96

Browse files
authored
Set correct content length when mutating calls (#2132)
This sets content length correctly when `tool/call` requests are modified by the Tool Config middleware. The issue manifests only when `pkg/transport/proxy/transparent` is used, which makes it a bit trickier to test. I manually tested the fix, but I've yet to find a decent way to test it. Fixes #2056
1 parent 6e0e831 commit 0081a96

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pkg/mcp/tool_filter.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,10 @@ func NewToolCallMappingMiddleware(opts ...ToolMiddlewareOption) (types.Middlewar
245245
next.ServeHTTP(w, r)
246246
return
247247
}
248+
248249
r.Body = io.NopCloser(bytes.NewBuffer(bodyBytes))
250+
// TODO: find a reasonable way to test this
251+
r.ContentLength = int64(len(bodyBytes))
249252

250253
// According to the current version of the MCP spec at
251254
// https://modelcontextprotocol.io/specification/2025-06-18/schema#calltoolrequest

0 commit comments

Comments
 (0)