Skip to content
This repository was archived by the owner on Apr 8, 2025. It is now read-only.

Conversation

pcarion
Copy link
Contributor

@pcarion pcarion commented Nov 27, 2024

When running the weather typescript example with the code of the doc, Claude reports an error: n.content.map is not a function

The error is due to the fact that the response to the tool request "get_forecast" is not compatible with the spec:

  • content should be an array
  • the mimeType is not supported as a text element, it should be type, and with the value text

Spec: https://spec.modelcontextprotocol.io/specification/server/tools/#tool-result

I checked the Python code and I see that the response is the same as the one that PR fixed:

          return [
              TextContent(
                  type="text",
                  text=json.dumps(forecasts, indent=2)
              )
          ]

FWIW, I documented the process to fix that issue here: https://pcarion.com/blog/claude_mcp/

@pcarion pcarion changed the title update tool response to be compliant with spec update tool response in typescript weather sample to be compliant with spec Nov 27, 2024
Copy link
Member

@dsp-ant dsp-ant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch and sorry for trouble. Thank you so much! I really appreciate the effort to go an fix this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants