A Tool is a live view over a Capsule. The Capsule is the durable executable payload.
1. What a Toolkit Is
A Toolkit groups Capsules under tool names and serving metadata. Use it when you want a set of functions to behave like a local API, an MCP server, or an export target for model tool calling. The durable model is intentionally small:Capsule: stores the executable function manifestTool: names one Capsule (plus an optional serializer Capsule) and exposesrun(...)andrun_to_str(...)Toolkit: orders tools, saves references, and exports serverssys-toolkit: persistent entity row storing the Toolkit manifest and Capsule references
jstr_serializer Capsule, which applies compact JSON serialization for dict and list results.
2. Build and Register a Toolkit
toolkit.register(...) saves each tool’s main Capsule and serializer Capsule, then stores the Toolkit manifest as ordered Capsule references. Loading a Toolkit restores the referenced Capsules lazily.
Toolkit.register(...) defaults to overwrite=True. Use on_conflict="raise" or on_conflict="skip" when you need explicit conflict handling.
For compact construction, pass a list, pairs, or a mapping:
3. Load and Run From Another Path
run_to_str(...) when you need the serialized string boundary that MCP and agent clients expect:
registry_config=... to isolate registry storage while keeping the same public API.
4. Architecture Data Flow
Toolkit execution is a thin layer over Capsules:Toolkit.add(callable)captures the callable as a main Capsule and resolves a serializer Capsule (defaultjstr_serializer).toolkit.register()persists both Capsules for each tool and then stores asys-toolkitrow containing ordered Capsule references.Toolkit.load(...)resolves the manifest and restores each referenced Capsule into aTool.Toolkit.run(name, **kwargs)calls the selected main Capsule locally and returns the raw Python value.Toolkit.run_to_str(name, **kwargs)runs the tool and passes the result through its serializer Capsule.Toolkit.to_fastmcp()wraps each Tool with a signature-compatible FastMCP function that returns serialized strings.Toolkit.to_anthropic_tools(...)exports a separate Anthropic programmatic tool schema withallowed_callers.
5. Serve Through MCP
toolkit.serve(...). Defaults live under heavenbase.mcp in CM_HVNB (transport, host, port, wait).
6. Import an MCP Server
register() because they close over a live server handle.
7. Workspace Toolkits
Every workspace can still become a Toolkit:sys-metaschema as toolkit_family rows; runtime workspace Toolkits still cannot be registered because they close over a live workspace object.
8. Demo
Toolkit.load(...), shows Capsule docstring and format conversion, and checks that FastMCP can list and call the tools.

