Repository navigation
Conversation
allozaur
force-pushed
the
allozaur/feat/tools-on-demand
branch
from
November 20, 2026 17:37
7d358f4 to
4bd97e2
Compare
allozaur
added a commit
that referenced
this pull request
Nov 20, 2026
allozaur
force-pushed
the
allozaur/feat/tools-on-demand
branch
from
November 21, 2026 14:38
4bd97e2 to
7e36807
Compare
allozaur
force-pushed
the
allozaur/feat/tools-on-demand
branch
from
November 24, 2026 06:24
7e36807 to
3368cf0
Compare
allozaur
force-pushed
the
allozaur/feat/tools-on-demand
branch
2 times, most recently
from
November 24, 2026 08:28
3e393d9 to
cc45689
Compare
allozaur
force-pushed
the
allozaur/feat/tools-on-demand
branch
from
November 24, 2026 09:40
cc45689 to
a2654bb
Compare
allozaur
force-pushed
the
allozaur/feat/tools-on-demand
branch
from
November 24, 2026 12:18
a2654bb to
cb6fa4f
Compare
allozaur
force-pushed
the
allozaur/feat/tools-on-demand
branch
from
November 24, 2026 13:57
cb6fa4f to
48d1a07
Compare
allozaur
force-pushed
the
allozaur/feat/tools-on-demand
branch
from
November 24, 2026 14:10
48d1a07 to
da26f0b
Compare
allozaur
force-pushed
the
allozaur/feat/tools-on-demand
branch
from
November 24, 2026 14:45
da26f0b to
732519c
Compare
With many tools enabled, their definitions take a large part of a local model's context and blur its choice. In on-demand mode the built-in and llama-server tools still go in full, and the MCP and custom tools go as a short list in the description of a tool_search tool: one line per tool, or per server once the list passes 5% of the context. A search by words, or select:name1,name2, returns the schemas, loads the tools and appends them to the next request. A call to a listed tool that was not loaded loads it and runs it, so a model that skips the search still works. Loaded tools stay loaded for the conversation, so the tool list only grows and llama-server can keep reusing its prompt cache. Settings > Tools > Tool loading: Automatic (default: on demand once the definitions would take a tenth of the context), On demand, or All up front. Loading a tool asks for no permission; the tool asks when called. Llama Harness gets one more hook for it, resolveTool, which finds a tool the model called that is not in the list. Assisted-by: Claude (Opus 5.5 Medium)
allozaur
force-pushed
the
allozaur/feat/tools-on-demand
branch
from
November 24, 2026 16:43
732519c to
95f735f
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
With many MCP tools enabled, Llama Chat no longer sends all their definitions in every request: the model sees a short list and loads the tools it needs, which keeps a local model's context for the conversation.
Additional information
Layer 4 of the planned stack, on #101 (permission rules). It sits below #61 with the other core layers; inserting them into the stack and restacking #61 and above is still to do. Not tried against a real MCP server with many tools yet.
What changed
tool_searchtool: one line per tool (name: first sentence), or one line per server once the list passes 5% of the context.tool_searchtakes words (create issue) orselect:name1,name2, returns the full schemas, and loads the tools; they are appended to the next request.Unknown tool.n_ctx), On demand, All up front.resolveTool, which finds a tool the model called that is not in the list.Testing
ui/lib/harness:npm run check,npm test(29 tests, 2 new forresolveTool),npm run prepack.ui/apps/chat:npm run check, lint on the changed files, and the 897 unit tests pass, includingtool-catalog.test.ts(ranking,select:, the short list per server, loading once, tools loaded earlier) and a flow test where the model calls a listed MCP tool directly and it is sent from the next request on.Requirements
Claude (Opus 5.5 Medium)