The model proposes. HeavenBase can execute — or just hand you the JSON and step back.
chat, stream, or LLMSession, and HeavenBase normalizes schemas, runs executable callables, and projects the full turn through include.
1. What You Can Pass
Thetools list accepts:
- OpenAI-compatible function schema dictionaries.
- Plain Python callables with type annotations and docstrings.
- HeavenBase
Toolobjects. - HeavenBase
Toolkitobjects, including MCP servers imported withToolkit.from_fastmcp(...).
tool_calls. Executable tools run automatically, and their role="tool" result messages appear in delta and messages.
Tool execution errors serialize as structured tool-result content:
2. Schema-Only Tools
Use schema-only tools when another process will execute the calls:tool_calls shape.
3. Executable Tools
Use functions or Toolkits when HeavenBase should run the tools for the model:add, HeavenBase appends the assistant tool-call message, a tool-result message, then asks the model for the final answer. A typical delta looks like:
max_tool_turns (default 8 in Python, mapped from --max-steps in the CLI):
achat instead of chat.
4. MCP as Toolkit
MCP servers become normal tools by importing them as a HeavenBase Toolkit:/mcp SOURCE. hb llm chat --max-steps caps assistant iterations in a tool loop; the default is 20.
5. Structured Output
Pass OpenAI-compatibleresponse_format arguments directly:
structured_stream: false.
Force a non-streaming structured call when you need a single reliable payload:
stream(..., enforce_non_stream_structured=True), HeavenBase performs one non-streaming request and yields a single projected chunk.
6. Tool-Call Repair
Some providers return malformed JSON intool_calls[].function.arguments. HeavenBase can repair common mistakes — fenced code blocks, unbalanced braces, missing required fields — before execution.
Repair is off by default. Enable it globally:
strict: true in config to raise when repair fails instead of returning the original arguments. See Advanced LLM for repair behavior details.

