// CONTENTS Part 04 · Assistant and AI

// PART 04

Tools, MCP, and model providers

Chapter 19 / 56 3 min read English Part 04 of 14

“Tools”, “MCP” and “model providers” are three different layers. This page separates them: which tools exist, how MCP servers plug in, and how the model provider is selected — including which routing mechanisms are wired and which are not.

Tools: what the model can call

Tool source Registered how Reached by
BASIC tool scripts .bas headers (PARAM, DESCRIPTION) compiled into basic_tools by the Drive monitor USE TOOL "name", LLM tool calls, TOOL_EXEC
Native tools built-in pipeline tools the model, during a turn
API command catalog declarative AppCommand / endpoint entries with admin_only flags __api_call__ (consent-gated)
MCP servers .mcp.json in the bot’s .gbdialog/ USE MCP / MCP client keywords (botbasic_ai/src/keywords/mcp_client/)
Integration catalog provider seeds with credential fields and actions botintegrations adapters

The catalog matters more than prompt text: an endpoint registered in the command catalog is callable by the LLM with a compact manifest, RBAC-filtered per role; an endpoint that is not registered is not reachable from chat at all — raw REST is deliberately not a chat surface.

MCP (Model Context Protocol)

A bot declares MCP servers in .mcp.json; the MCP client keywords list tools and invoke them at turn time. The MCP formats (tool definition and message shape) are documented in the API reference. MCP is the intended way to expose external systems that already speak the protocol, instead of writing a BASIC wrapper per endpoint.

Model providers

The provider that answers chat turns is built once at boot:

// botserver/src/main_module/state_builder.rs
let base_llm_provider = create_llm_provider_from_url(url, model, key);
  • Configuration: Vault secret/gbo/{org}/{branch}/{bot} (llm-url, llm-model, llm-key, llm-provider, system-prompt, history-limit), global fallback secret/gbo/llm.
  • Environment fallback when Vault has no entry: LLM_URL, LLM_MODEL, LLM_KEY (or OPENAI_API_KEY).
  • The provider type is auto-detected from the URL pattern; any OpenAI-compatible chat-completions endpoint works, including a local llama.cpp server.
  • Local embeddings are a separate service: embedding-url + embedding-model (default model all-MiniLM-L6-v2), used by retrieval.

Model routing: what is wired and what is not

Three “routing” mechanisms exist in the code; only one is on the live path:

Mechanism Where Wired?
Boot-time single provider from Vault state_builder.rs Yes — every turn
Multi-profile router with circuit breaker and council (GB_LLM_PROFILES) botllm/src/{profiles,router,breaker,council}.rs No — library API, no production caller
BASIC USE MODEL / SET MODEL ROUTING botbasic_ai/src/keywords/model_routing/ Persists a session preference that the pipeline never reads

A fourth module, botllm/src/smart_router.rs, is unreachable: its entry-point keyword is not registered and its performance cache has no writers. Setting GB_LLM_PROFILES therefore does not change chat behavior today; treat the router as an available library API until a caller exists in pipeline/llm/.

Provider facts worth knowing

Question Answer
Can I point a bot at a local model? Yes — any OpenAI-compatible URL; the desktop editions run llama.cpp
Can two bots use different models? Yes — per-bot Vault entries; but the provider is built at boot, so changes need a restart
Does the platform send system prompts per channel? Yes — PROMPT-{CHANNEL}.md in the bot’s .gbot/
How do I add a tool? Write a .bas with PARAM/DESCRIPTION; the monitor compiles it (see BASIC API and codegen)
How do I expose an HTTP API to chat? Register it in the API command catalog; do not rely on prompt text

What this page deliberately omits

Model comparison tables (context windows, speed tiers) and provider pricing are marketing facts that change weekly and are not encoded in this repository — this book does not restate them. The code facts are the configuration keys, the boot-time provider, and the registered keyword surfaces above.

Found a mistake? Open an issue · All books

// SEARCH ESC
Pagefind · 236 pages · 4 books Enter to open ↑ ↓ to move