Skip to content

bug: StructuredContent not parsed in utils.ParseCallToolResult #522

@Suvigo

Description

@Suvigo

Description

When I use the NewStreamableHttpClient of mcp-go version 0.36.0 to perform the callTool operation, I return mcp.NewToolResultStructuredOnly(result) or mcp.NewToolResultStructured(result, "SUCCESS") on the server side. The result is a struct structure. The local test server result struct is as follows:

Image

However, when I use mcp-client to execute the tool through the tool/call method, the StructuredContent parameter does not exist in the returned result. The parameter is nil:

Image

Debug found that in the ParseCallToolResult of CallTool, there was no operation to parse StructuredContent and assign a value. In the returned result, StructuredContent was nil, which caused this problem.

Code Sample

my mcp-server code:

Image

my mcp-client code:

Image

maybe the problem code in mcp-go 0.36.0

Image

Logs or Error Messages

Environment

  • Go version (see go.mod): 1.23
  • mcp-go version (see go.mod): 0.36.0
  • Any other relevant environment details: Centos 7.5

Possible Solution

when i add resutl.StructuredContent = jsonContent["StructuredContent"] in utils.ParseCallToolResultParseCallToolResult, it will solve this problem

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions