MCPcopy Create free account
hub / github.com/modelcontextprotocol/go-sdk / Read

Method Read

mcp/streamable.go:1764–1778  ·  view source on GitHub ↗

Read implements the [Connection] interface.

(ctx context.Context)

Source from the content-addressed store, hash-verified

1762
1763// Read implements the [Connection] interface.
1764func (c *streamableClientConn) Read(ctx context.Context) (jsonrpc.Message, error) {
1765 if err := c.failure(); err != nil {
1766 return nil, err
1767 }
1768 select {
1769 case <-ctx.Done():
1770 return nil, ctx.Err()
1771 case <-c.failed:
1772 return nil, c.failure()
1773 case <-c.done:
1774 return nil, io.EOF
1775 case msg := <-c.incoming:
1776 return msg, nil
1777 }
1778}
1779
1780// Write implements the [Connection] interface.
1781func (c *streamableClientConn) Write(ctx context.Context, msg jsonrpc.Message) error {

Callers

nothing calls this directly

Calls 3

failureMethod · 0.95
DoneMethod · 0.45
ErrMethod · 0.45

Tested by

no test coverage detected