Skip to content

docs: use fluent tool builder syntax in README#6

Merged
0xeb merged 1 commit intomainfrom
docs/fluent-tool-readme
Jan 30, 2026
Merged

docs: use fluent tool builder syntax in README#6
0xeb merged 1 commit intomainfrom
docs/fluent-tool-readme

Conversation

@0xeb
Copy link
Owner

@0xeb 0xeb commented Jan 30, 2026

Summary

  • Replace verbose JSON schema construction with cleaner fluent API examples
  • Lead with ToolBuilder for full control, then make_tool() for quick one-liners
  • Auto-generated JSON schemas from C++ types - no more manual JSON!

Before

calc_tool.parameters_schema = copilot::json{
    {"type", "object"},
    {"properties", {{"expression", {{"type", "string"}}}}},
    {"required", {"expression"}}
};

After

auto calc = copilot::ToolBuilder("calculator", "Perform math calculations")
    .param<std::string>("expression", "Math expression to evaluate")
    .handler([](std::string expression) { return "42"; });

Test plan

  • README snippets verified to compile and run

Replace verbose JSON schema construction with cleaner fluent API:
- ToolBuilder with .param<T>() for type-safe parameters
- make_tool() for quick one-liners
- Auto-generated JSON schemas from C++ types

Also add tests/.gitignore for byok.env (API keys)
@0xeb 0xeb merged commit a3565bd into main Jan 30, 2026
3 checks passed
@0xeb 0xeb deleted the docs/fluent-tool-readme branch January 30, 2026 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant