Skip to content

Conversation

@francistm
Copy link
Contributor

When calling ServerSession.CreateMessage, will get an json unmarshal error because CreateMessageResult.Content is an interface, and it doesn't implement json.Unmarshaller.

Implement the json.Unmarshaller to CreateMessageResult, let it able to unmarshal the client response without error

mcp/protocol.go Outdated
}

func (r *CreateMessageResult) UnmarshalJSON(data []byte) error {
type result CreateMessageResult
Copy link
Contributor

Choose a reason for hiding this comment

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

add the comment "// avoid recursion"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added

@jba
Copy link
Contributor

jba commented Jul 29, 2025

Thanks, good catch!

@francistm francistm force-pushed the feat/add-unmarshal-json-to-create-mesg-result branch from ced57a9 to b939d66 Compare July 29, 2025 21:50
@francistm francistm requested a review from jba July 29, 2025 21:50
jba
jba previously approved these changes Jul 30, 2025
@jba
Copy link
Contributor

jba commented Jul 30, 2025

Please fix failing test.

@francistm
Copy link
Contributor Author

Please fix failing test.

I've update the stub in unittest, should be working now

@francistm francistm requested a review from jba July 30, 2025 16:38
@jba jba merged commit bacca7a into modelcontextprotocol:main Jul 30, 2025
3 checks passed
@francistm francistm deleted the feat/add-unmarshal-json-to-create-mesg-result branch August 1, 2025 01:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants