Documentation
¶
Overview ¶
Package bridge serves tools to agent processes over MCP on localhost.
Each agent gets its own namespace (/mcp/<agent>) holding the shared tools plus any the agent contributes via agent.ToolProvider. A tool call is routed to the Handler of the conversation that made it.
Index ¶
Constants ¶
View Source
const Name = "pocketagent"
Name is the MCP server name agents see.
Variables ¶
View Source
var SendFile = agent.Tool{ Name: "send_file", Description: "Send a file from this machine to the user's chat. Images (png/jpg/gif/webp) " + "are shown inline; anything else is sent as a document. Use it when the user asks to " + "see a screenshot, chart, image or file.", Schema: map[string]any{ "type": "object", "required": []string{"path"}, "properties": map[string]any{ "path": map[string]any{"type": "string", "description": "absolute path of the file to send"}, "caption": map[string]any{"type": "string", "description": "optional short caption"}, }, }, Call: func(ctx context.Context, h agent.Handler, args json.RawMessage) (string, error) { var in struct { Path string `json:"path"` Caption string `json:"caption"` } if err := json.Unmarshal(args, &in); err != nil { return "", err } if !filepath.IsAbs(in.Path) { return "", fmt.Errorf("path must be absolute") } if err := h.SendFile(ctx, in.Path, in.Caption); err != nil { return "", err } return "sent", nil }, }
SendFile lets an agent send a file from this machine to the conversation.
Functions ¶
This section is empty.
Types ¶
type Bridge ¶
type Bridge struct {
// contains filtered or unexported fields
}
func Start ¶
Start listens on a random port. host is how agents reach it: "" or 127.0.0.1 normally, host.docker.internal for agents in containers. shared tools are offered to every agent.
func (*Bridge) AddAgent ¶ added in v0.6.0
AddAgent creates the namespace for an agent with the shared tools plus extra.
Click to show internal directories.
Click to hide internal directories.