Documentation Index
Fetch the complete documentation index at: https://ahvn.top/llms.txt
Use this file to discover all available pages before exploring further.
import heavenbase as hb
toolkit = hb.Toolkit("math-tools", namespace="demo", version="1")
| Method | Purpose |
|---|
Toolkit.add(item, name=...) | Add a callable, Capsule, or Tool. |
Toolkit.run(tool_name, **kwargs) | Run one tool locally. |
Toolkit.register(registry_config=...) | Save tool Capsules and the Toolkit manifest. Defaults to heavenbase.capsule.registry. |
Toolkit.load(..., registry_config=...) | Load a Toolkit from registry records by id or namespace/name/version. |
Toolkit.to_fastmcp() | Build an in-process FastMCP server. |
Toolkit.to_mcp_json(...) | Return MCP client configuration JSON. |
Toolkit.serve(...) | Run the FastMCP server. |
Toolkit.to_anthropic_tools(...) | Export programmatic tool definitions with allowed_callers. |
Capsule API
| Method | Purpose | | | |
|---|
Capsule.from_func(func, ...) | Capture a callable as a Capsule manifest. | | | |
capsule.register(registry_config=...) | Store the Capsule in the default or configured registry. | | | |
Capsule.load(..., registry_config=...) | Load by id or namespace/name/version. | | | |
capsule.to_func() | Restore the callable using source, import path, then trusted binary fallback. | | | |
capsule.run(**kwargs) | Restore and call the function. | | | |
| `capsule.to_str(“json" | "yaml" | "source" | "docstring”)` | Convert the Capsule manifest or callable metadata to a text representation. |
Capsule.from_str(text, format="json") | Restore a Capsule from a JSON or YAML manifest string. | | | |
Callable serialization
Internal callable serialization lives in heavenbase.capsule.serialize:
from heavenbase.capsule.serialize import CallableSerialization
payload = CallableSerialization.from_func(add, include_cloudpickle=False).to_dict()
capsule = CallableSerialization.from_dict(payload).to_capsule()
Generic JSON serialization uses the same strategy for callables and falls back to a lightweight reference for callables that cannot be captured.
Registry entities
| Entity | Contents |
|---|
capsule | Active Capsule manifests. |
capsule-revision | Append-only Capsule revisions. |
toolkit | Active Toolkit manifests and Capsule references. |
toolkit-revision | Append-only Toolkit revisions. |
workspace.to_mcp(...) and workspace.serve(...) expose these native Toolkit tools:
| Tool | Purpose |
|---|
define_entity | Create or update an entity schema from JSON. |
list_entities | List registered entity ids. |
describe_entity | Return one entity schema and route plan. |
upsert | Insert or replace one row. |
upsert_many | Insert or replace rows. |
get | Fetch one row by id. |
get_many | Fetch rows by ids. |
set | Apply one row patch. |
set_many | Apply row patches. |
delete | Delete one target. |
delete_many | Delete targets in input order. |
exists | Check one id. |
exists_many | Check ids in input order. |
count | Count rows for one entity type. |
query | Execute a JSON query spec. |
explain | Explain route and handler choices for a JSON query. |
Serving options
workspace.serve(
name="notes",
transport="http",
host="127.0.0.1",
port=7011,
wait=True,
)
Defaults live under heavenbase.mcp:
| Config key | Default |
|---|
heavenbase.mcp.transport | http |
heavenbase.mcp.host | 127.0.0.1 |
heavenbase.mcp.port | 7001 |
heavenbase.mcp.wait | true |
Health check
Use a FastMCP client to verify the server can list and call tools:
from fastmcp import Client
server = toolkit.to_fastmcp()
async with Client(server) as client:
tools = await client.list_tools()
result = await client.call_tool("add", {"left": 2, "right": 3})
result.structured_content contains the tool return value under result for scalar Python returns.
Anthropic programmatic tool calling is a separate export path from MCP connector tools:
tool_defs = toolkit.to_anthropic_tools(allowed_callers=["code_execution"])
Each definition includes allowed_callers, name, description, and input_schema. Tool runtime adapters should return strings when called from code execution.
Related pages