Skip to content

feat(tools): native tool integration for MCP and Ollama (#940)#947

Merged
bug-ops merged 2 commits intomainfrom
feat/native-tools-940
Feb 26, 2026
Merged

feat(tools): native tool integration for MCP and Ollama (#940)#947
bug-ops merged 2 commits intomainfrom
feat/native-tools-940

Conversation

@bug-ops
Copy link
Owner

@bug-ops bug-ops commented Feb 26, 2026

Summary

  • Phase 1: MCP tools are now exposed as native ToolDefinitions via McpToolExecutor.tool_definitions() and dispatched through execute_tool_call() using qualified server:tool names. MCP text prompt injection is suppressed when the provider supports native tool_use. Tool list stays in sync with /mcp add//mcp remove via shared Arc<RwLock<Vec<McpTool>>>.
  • Phase 2: OllamaProvider now supports native tool calling via chat_with_tools() using the ollama_rs tool API. Opt-in via llm.ollama.tool_use = true (default: false).
  • Refactor: ToolDef.id/description changed from &'static str to Cow<'static, str> to accommodate dynamic MCP tool names.

Test plan

  • cargo nextest run --workspace --lib --bins — 2866 tests pass
  • cargo clippy --workspace -- -D warnings — clean
  • cargo +nightly fmt --check — clean
  • Manual: connect MCP server, verify tools appear in native tool_use loop with Claude/OpenAI
  • Manual: set llm.ollama.tool_use = true with llama3.1+, verify tool calls round-trip

Closes #940

…actor

Phase 1 — MCP native tools:
- McpToolExecutor implements tool_definitions() and execute_tool_call(),
  exposing MCP tools as native ToolDefinitions (qualified server:tool names)
- McpState.shared_tools (Arc<RwLock<Vec<McpTool>>>) wired through builder
  and synced on /mcp add/remove
- append_mcp_prompt() skips text injection when provider.supports_tool_use()

Phase 2 — Ollama native tool calling:
- OllamaProvider implements supports_tool_use() and chat_with_tools()
  via ollama_rs tool API
- OllamaConfig.tool_use flag (default false); enable with
  llm.ollama.tool_use = true in config

Refactor — ToolDef.id/description changed from &'static str to
Cow<'static, str> to support dynamic MCP tool names; all call sites updated

Closes #940
@github-actions github-actions bot added documentation Improvements or additions to documentation llm LLM provider related rust core dependencies enhancement New feature or request size/XL labels Feb 26, 2026
@bug-ops bug-ops enabled auto-merge (squash) February 26, 2026 02:04
@bug-ops bug-ops merged commit 766a75c into main Feb 26, 2026
28 checks passed
@bug-ops bug-ops deleted the feat/native-tools-940 branch February 26, 2026 02:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core dependencies documentation Improvements or additions to documentation enhancement New feature or request llm LLM provider related rust size/XL

Projects

None yet

1 participant