Documentation
¶
Overview ¶
Package client provides the native Tinyrelay transport used by tinyagent.
Index ¶
- type Client
- func (c *Client) Download(ctx context.Context, requestPath string) (map[string]any, error)
- func (c *Client) Identity() map[string]string
- func (c *Client) MCP(ctx context.Context, method string, params map[string]any, ...) (json.RawMessage, error)
- func (c *Client) Publish(ctx context.Context, e nostr.Event) (nostr.Event, error)
- func (c *Client) Query(ctx context.Context, filters []Filter) ([]nostr.Event, error)
- func (c *Client) Request(ctx context.Context, requestPath, method string, body json.RawMessage) (any, error)
- func (c *Client) Subscribe(ctx context.Context, name string, filter Filter, sink EventSink) error
- func (c *Client) Upload(ctx context.Context, room, filename, typ string, data []byte) (UploadResult, error)
- type EventSink
- type Filter
- type MCPError
- type UploadResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
func (*Client) MCP ¶
func (c *Client) MCP(ctx context.Context, method string, params map[string]any, info mcp.Implementation) (json.RawMessage, error)
MCP posts one JSON-RPC request to the relay's stateless MCP endpoint and returns the raw result. Each call carries a fresh NIP-98 proof bound to the URL and body, the mirrored Mcp-* headers and the reserved _meta fields. The endpoint is /mcp under the client's base URL, so a tenant served under a path prefix is reached at /r/<name>/mcp.
type MCPError ¶
MCPError is a JSON-RPC error answered by the relay's MCP endpoint together with the HTTP status it arrived with. Failures to reach the relay at all are returned as ordinary errors instead.