curl --location 'http://localhost:8000/mcp' \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/list_invalid",
"params": {
"submitter": "test",
"content": {
}
}
}
if err := p.transport.Send(ctx, transport.NewBaseMessageError(response)); err != nil {
p.handleError(fmt.Errorf("failed to send error response: %w", err))
}
...
// Send implements Transport.Send
func (t *GinTransport) Send(ctx context.Context, message *transport.BaseJsonRpcMessage) error {
key := message.JsonRpcResponse.Id
responseChannel := t.responseMap[int64(key)]
if responseChannel == nil {
return fmt.Errorf("no response channel found for key: %d", key)
}
responseChannel <- message
return nil
}