Documentation
¶
Overview ¶
Package codemode runs Starlark scripts that call outbound MCP tools.
Index ¶
- Constants
- func BuildCatalog(tools []ToolDesc) (map[string]ToolDesc, error)
- func Run(ctx context.Context, source string, tools []ToolDesc, decide DecideFunc, ...) (string, error)
- func SanitizeTool(mcpToolName string) string
- func StarlarkName(server, mcpToolName string) string
- type CallFunc
- type DecideFunc
- type HostTool
- type ToolDesc
Constants ¶
const ( // DefaultConcurrency is the per-call width when concurrency= is omitted. DefaultConcurrency = 16 // MaxConcurrency is the per-call ceiling and the execute-wide in-flight branch cap. MaxConcurrency = 64 )
Variables ¶
This section is empty.
Functions ¶
func BuildCatalog ¶
BuildCatalog maps starlark name -> ToolDesc; fails on starlark name collision.
func Run ¶
func Run(ctx context.Context, source string, tools []ToolDesc, decide DecideFunc, call CallFunc, host []HostTool) (string, error)
Run executes Starlark source requiring def main() returning a value. mcp tools use decide+call; host tools use HostTool.Call (caller enforces permissions). Returns string result (string as-is; other values JSON; None is error).
func SanitizeTool ¶
SanitizeTool maps non [A-Za-z0-9_] to _; prefixes _ if needed for valid ident start.
func StarlarkName ¶
StarlarkName returns sanitizedserver_sanitizedtool for a tool. Server names may contain '-' and '.' (MCP name charset); Starlark needs [A-Za-z0-9_].
Types ¶
type DecideFunc ¶
DecideFunc is per-call permission like bash. subject is "server.tool" (raw MCP tool name). Return nil to allow; error to deny/fail the Starlark builtin.