Documentation
¶
Overview ¶
Package tetherlink calls Tether's tools over MCP for a module: a stdio command (the local bridge, one process per call) or MCP's streamable HTTP. Each client names the only tools it may call; nothing else is reachable through it, whatever the far side offers. A tool's own failure is reported without its text: what Tether says may carry more than a reason.
Extracted from the Design module's client (modules/design/mcp.go), which it will replace.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrRefused = errors.New("tether: the call was refused")
ErrRefused is a tool's own failure. Its text is not passed on: what Tether says may carry more than a reason, and nothing from the far side is echoed into the conversation.
Functions ¶
func ReadToken ¶
ReadToken reads a bearer token from a file. The token is never logged or returned in an error.
func ToolText ¶
func ToolText(raw json.RawMessage) (string, error)
ToolText reads a tools/call result: its text content, or the error it reports. When the gateway cut a large result short, the answer is two text blocks: the result (as much of it as was kept) and a {"gateway_truncated": ...} note. The note is set aside, so the text is still the tool's own JSON; ask for less (a smaller limit) to get it whole.
Types ¶
type Caller ¶
type Caller interface {
Call(ctx context.Context, tool string, args map[string]any) (string, error)
}
Caller calls one tool on an MCP server and returns its text result.
type Config ¶
Config is how a module reaches Tether: an MCP URL (with a token file) or a stdio command.
type HTTP ¶
type HTTP struct {
// Module names the caller in errors and to the server.
Module string
URL string
TokenFile string
Client *http.Client
Allowed Allowed
// contains filtered or unexported fields
}
HTTP speaks MCP's streamable HTTP transport: JSON-RPC posted to one URL, answered with JSON or with an event stream carrying the answer.