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 ¶
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 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.
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, baseURL string, gateway Gateway, session func() mcp.ToolSessionContext) (*Mount, error)
Serve mounts the gateway behind a freshly minted route under baseURL (the workspace-local tools proxy address). 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.