dsh-tool-search
DiscoveredDeepSeek Harness plugin: load MCP tool definitions on demand with tool_search
dsh-tool-search
English | Português
A DeepSeek Harness plugin that keeps large tool sets, such as many MCP servers, out of every model request. Tool definitions are loaded on demand with a tool_search tool.
With many MCP servers configured, every request carried hundreds of definitions the agent never used. In one measured native desktop session, 480 tools weighed 396 KB of JSON per request, and 352 KB of that was MCP definitions. With this plugin the model sees a short list of tool groups plus tool_search, and the tools it loads are declared from its next step.
Deferred tools stay registered and executable. Only the declaration size of each request changes. Deferral is presentation, not access control; use the harness's own tool restrictions to forbid a tool.
Install
The module has no package imports and reads everything from the Cordis ctx, so one file mounts by absolute path. Add a row to your profile patch (cordis.patch.yml):
- insert:
- id: tool-search
name: 'C:/path/to/dsh-tool-search/index.mjs'
config:
defer:
- 'mcp__*'
keep:
- 'mcp__memory__*'
maxResults: 8
The host caches plugin modules, so restart it after you change the file. Removing the row restores the full declarations.
| Field | Default | Meaning |
|---|---|---|
defer | required | *-wildcard patterns over complete tool names. Matching tools are withheld until loaded. |
keep | [] | Patterns that are never withheld, even when defer matches. |
maxResults | 8 | Most tools one keyword search loads. |
An empty defer list, an empty pattern, or a non-positive maxResults fails when the plugin loads.
How it works
The model calls tool_search with query keywords, exact names, or both. Keyword search ranks unloaded deferred tools by how many query terms their names and descriptions contain (name hits count more) and loads the best maxResults. A name that no pattern defers is reported as already loaded; an unknown name is reported as unknown.
- Native mode. The plugin removes deferred entries from the tools of
system-prompt/assembleand adds a catalog section that lists each deferred group once with its tool count. - PTC mode. The plugin rewrites the generated
tools:sdksection, removing deferred members fromToolArgsMapandToolOutputMap. The model callsawait tools.tool_search({ query })insiderun_code. A layout it does not recognize is left unfiltered, with one warning in the log. - Per agent. Loading is per agent. A subagent starts with nothing loaded. A resumed native session keeps the tools its last logged request header declared, provided that header already declared
tool_search. A resumed PTC session starts empty.
Compatibility
Verified on DeepSeek Harness 0.2.1-alpha.2. Newer releases moved tool declarations out of the system-prompt/assemble assembly into the provider. On such a release native deferral is inactive: the plugin leaves the assembly untouched and logs one warning (native deferral is inactive) instead of failing prompt assembly. The PTC filter depends on the member layout that the SDK generator emits.
Known limits
- Deferral hides declarations only. A model that guesses an unloaded tool name can still call it.
- Loaded tools are never unloaded within a session.
- Keyword ranking is plain term containment, with no stemming or synonyms.
- Loading a tool changes the tool list (native) or the SDK text (PTC), so the cached request prefix after that point is rewritten on the next request. Loading related tools in one search limits the rewrites.
- In PTC mode
tool_searchruns insiderun_code, which costs one program per search.
Test
npm test
The tests use a fake Cordis context and need neither DeepSeek Harness nor any dependency.
License
MIT
Comments
Loading…
Similar plugins
by MikotoMyWife
Lazy-loading MCP tools for DeepSeek Harness (DSH): one loader tool per multi-tool MCP server, per-agent tool masking, description presets
★ 0
MIT
TypeScript
Oct 8, 2026
dsh plugin --profile web add dsh-mcp-loaderby openma-ai
mcp apps support plugin for dsh (DeepSeek Harness)
★ 4
↓ 81/wk
MIT
TypeScript
Aug 22, 2026
dsh plugin --profile web add @openma/dsh-mcp-appsby bobleer
MCP server that lets any agent discover, install, and run DeepSeek Harness plugins (topic: dsh-plugin).
★ 3
MIT
TypeScript
Aug 13, 2026
dsh plugin --profile web add deepseek-harness-plugin-mcpby sugarforever
DeepSeek Plugin that supports MCP Apps
★ 5
↓ 37/wk
MIT
TypeScript
Aug 15, 2026
dsh plugin --profile web add @sugarforever/dsh-mcp-appsby Fleey
DeepSeek Harness plugin: choose which skills and MCP servers each workspace may use
★ 0
MIT
JavaScript
Nov 5, 2026
dsh plugin --profile web add dsh-workspace-capabilitiesby sduwall
A plugin for managing MCP servers in DeepSeek Harness.
★ 0
MIT
JavaScript
Sep 20, 2026
dsh plugin --profile web add @sduwall/dsh-wall-mcp-manager