Documentation
¶
Overview ¶
Package toolmount serves the Memoh tool gateway (HTTP MCP) into a bot workspace over the bridge's reverse-HTTP stream, so an external agent runtime inside the container reaches Memoh tools at the workspace-local proxy URL. Each mount owns one unguessable route; the tool session identity resolves live per request, so one mount can outlive many turns.
Index ¶
- func EmitUnavailableNotice(sink external.EventSink, reason string)
- func IdleSession(botID string) mcp.ToolSessionContext
- func RegisterTurnSink(contexts *mcp.ToolSessionContextStore, botID, sessionID, runID string, ...) func()
- func ResolveBaseURL(info bridge.WorkspaceInfo, inputURL string) string
- func TurnSession(ctx context.Context, input external.PromptInput) mcp.ToolSessionContext
- type Gateway
- type Mount
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EmitUnavailableNotice ¶
EmitUnavailableNotice makes a tool-plane degradation visible in the conversation instead of only in server logs.
func IdleSession ¶
func IdleSession(botID string) mcp.ToolSessionContext
IdleSession is the identity of a mount between turns: the bot alone. The gateway lists tools for it but refuses to run them, since no run owns the call.
func RegisterTurnSink ¶
func RegisterTurnSink(contexts *mcp.ToolSessionContextStore, botID, sessionID, runID string, emit func(event.StreamEvent)) func()
RegisterTurnSink routes gateway tool events (tool cards, approval requests, ask_user prompts from Memoh MCP tools) for one turn into its stream and returns the unregister func. Without this registration the approval flow sees every request as undeliverable and rejects it.
func ResolveBaseURL ¶
func ResolveBaseURL(info bridge.WorkspaceInfo, inputURL string) string
ResolveBaseURL picks the mount base for a workspace. Container-backed workspaces always use the workspace-local tools proxy — the only address the agent inside the container can reach; the request-derived URL is meaningless there (and empty behind proxies that rewrite Host). Other backends fall back to the caller-provided externally reachable URL.
func TurnSession ¶
func TurnSession(ctx context.Context, input external.PromptInput) mcp.ToolSessionContext
TurnSession is the trusted identity of the tool calls one turn makes. It comes from the turn's input and context only, never from the HTTP request.
Types ¶
type Gateway ¶
type Gateway struct {
Tools *mcp.ToolGatewayService
Contexts *mcp.ToolSessionContextStore
Logger *slog.Logger
}
Gateway is the Memoh MCP tool surface a mount serves.
type Mount ¶
type Mount struct {
// URL is the workspace-local MCP endpoint for the runtime's config.
URL string
// contains filtered or unexported fields
}
Mount is one live reverse-HTTP tool route inside a workspace.
func Serve ¶
func Serve(ctx context.Context, client *bridge.Client, info bridge.WorkspaceInfo, inputURL string, gateway Gateway, session func() mcp.ToolSessionContext) (*Mount, error)
Serve mounts the gateway behind a freshly minted route in the workspace; inputURL is the caller's externally reachable tools URL, used only by non-container workspaces. session resolves the trusted tool identity per request; it must never trust anything from the HTTP request. The mount lives until Stop or until ctx ends.