Expand description
Stage: strip tools from requests to models that cannot call them.
A client that always advertises its tools (most agentic harnesses do)
will send them to whatever model is selected. For a model without
ModelCapabilities::SUPPORTS_TOOL_CALLS, forwarding the array is worse
than useless: llama-server either rejects the request outright or renders
dozens of schemas into the prompt of a model that will only parrot them
back as text. The WebUI’s chat path has stripped tools this way since it
existed; this stage gives every apply caller — the proxy above all —
the same behaviour.
The check is deliberately conservative: it acts only on a
catalog_resolved context. A
passthrough context has an empty capability bitfield because nobody
knows what the model supports, and stripping tools from an unknown model
would silently break a working agent. Unknown models keep their tools.
Functions§
- strip_
unsupported_ tools - Remove
toolsandtool_choicewhen the resolved model cannot use them.