# Tool Selection
Tool selection uses fast, cost-effective LLMs to navigate the catalog hierarchy.
## Selection Process
```
Task: "Send a message to #general saying hello"
|
v
+---------------------------------+
| Categories: |
| - communication (messaging...) | <-- LLM selects
| - database (SQL, queries...) |
| - files (storage, documents...) |
+---------------------------------+
|
v
+---------------------------------+
| Services (communication): |
| - slack (Slack messaging) | <-- LLM selects
| - email (Email sending) |
| - teams (Microsoft Teams) |
+---------------------------------+
|
v
+---------------------------------+
| Tools (slack): |
| - send_message | <-- LLM selects
| - list_channels |
| - create_channel |
+---------------------------------+
|
v
+---------------------------------+
| Parameter Extraction: |
| channel: "#general" |
| message: "hello" |
+---------------------------------+
```
## Adaptive Depth
If a level has only one option, it's automatically selected:
```
Task: "Query the database"
|
v
database/ (only category with DB)
|
v
postgres/ (only service) <-- Auto-selected
|
v
[Show tools]
```
## LLM Prompts
### Category Selection
```
Given the task: "{task}"
Select the most appropriate category:
1. communication - Tools for messaging, email, notifications
2. database - Database queries and operations
3. files - File storage and management
Respond with the category name only.
```
### Tool Selection
```
Given the task: "{task}"
Select the appropriate tool and extract parameters:
Available tools:
- send_message: Send a message to a Slack channel
Parameters: channel (required), message (required), thread_ts (optional)
- list_channels: List all Slack channels
Parameters: limit (optional)
Respond in JSON:
{
"tool": "tool_name",
"parameters": {...}
}
```
## Why Fast LLMs?
Tool selection doesn't need Claude's reasoning capabilities:
| Provider | Model | Latency | Cost |
|----------|-------|---------|------|
| Cerebras | Llama 3.3 70B | ~100ms | Very low |
| Google | Gemini Flash | ~150ms | Low |
| Anthropic | Claude | ~500ms | Higher |
Fast selection = responsive user experience.
## Fallback Behavior
If the LLM cannot determine the right tool:
1. Ask for clarification via the result
2. Suggest possible options
3. Never execute an uncertain tool