DSH plugin tools: how DeepSeek Harness registers them
A registered tool in DeepSeek Harness is a ToolDefinition: a schema plus an execute function, with the output declaration required, and parameters and output described by the same JSON value schema (source). Tools are the bridge between the model and the outside world: the model cannot read files or reach the network by itself, it can only request a tool call, and what actually does the work is the execute function registered in the system. This piece covers how a tool is registered, made visible and run; the built-in list is in built-in tools in DeepSeek Harness, writing one is in how to build a tool plugin, and its place in the chain in how one turn runs.
Why tools are the bridge between the model and the world
The model can only produce text: it cannot touch the file system, the network or any external resource, so every outward action must go through a tool — that is the root reason the tool mechanism exists (source). Once that boundary is clear, several things follow:
- Tools decide "what is possible": how much capability the model can read depends on which tools are registered in the current environment; a capability that is not registered cannot even be conceived of.
- Tools are where permissions land: because real execution happens inside a tool, "whether an action touches your files" depends on the tool and its constraints, not on what the model said.
- Tools are the main exit for plugin capability: the most common way a DSH plugin gives the model a new ability is to register a tool — the most visible form of everything-is-a-plugin.
So understanding the tool mechanism is understanding "how much the model can do, who executes it, and what limits it" — three questions in one.
What a tool is: a schema plus an execute function
A registered tool in DeepSeek Harness is a ToolDefinition — a schema plus an execute function, with output required; the execute function runs only on an accepted call and returns a conforming value (source). Three points:
- The schema defines the boundary: it describes which parameters the tool accepts and what it returns, and is the part the model sees; the model uses it to decide which tool to use and what to pass.
outputis required: the return value must have an explicit declaration, and results are validated against it, so what the model gets is predictable.- The execute function does the work: it runs on a frozen snapshot of arguments and returns a value conforming to
output; it does not talk to the model, it just takes arguments and gives a result.
Registration is a trusted in-process contract: the registry validates schema and semantic requirements, then execution and display share the same resolved definition. For writing one, see how to build a tool plugin.
Parameters and output share one schema
DeepSeek Harness describes a tool's parameters and output with the same JSON value schema DSL: the author declares types with one vocabulary, and the compiler turns it into a supported subset of raw JSON Schema (source). Why this helps:
- Consistent declarations: parameters and output do not use two vocabularies, cutting down on inconsistencies between the two sides.
- Common types covered: string, number, integer, boolean, null, array, object, and
oneOffor exactly one matching branch — enough for most tool shapes. - Open by default, tightened under control: raw JSON Schema stays open by default, and unsupported keywords are rejected rather than admitted but unenforced — better to fail early than to leave a declaration that does not take effect.
- Author-side type inference: because it is one controlled vocabulary, writing declarations with author-side type inference surfaces problems in parameters and output earlier.
How the model sees the tools: schema projected into the prompt
The model "knows" which tools exist because each tool's schema is projected into the per-turn system prompt prefix — what the model reads is the projection from the registry (source). This line explains three things:
- Register and it is visible: once a tool is registered, its schema joins prefix assembly, so the model can see it in later turns.
- More tools, longer prefix: every extra tool means another description in the prefix, a main source of context overhead; see system prompt explained.
- Changing the schema changes the model's basis for acting: adjusting parameter descriptions does not just change documentation, it changes when and how the model uses the tool.
The execution pipeline: waterfall makes execution wrappable
Tool execution runs through an extensible waterfall event pipeline that applies monotonic policy, with each step processed in waterfall semantics (source). Why waterfall rather than a direct call:
- Execution can be wrapped: there are steps before and after the actual function, so a plugin can step in — wrapping, recording or adding constraints — without changing the tool itself.
- Monotonic policy never loosens: policy on the pipeline tightens downstream; a later step can add restrictions but cannot undo what an earlier step fixed, so constraints only accumulate.
ctx.toolsis the service entry: registration, schema projection and dispatch are all exposed there, so a DSH plugin joins the tool lifecycle without editing the core.
Scope filtering: how ToolRestriction narrows visibility
In DeepSeek Harness, ToolRestriction is a scope's live filter over the tools it inherits: it narrows the visible set by name, multiple restrictions intersect, and that scope's own registrations are unaffected (source). Three points:
- It applies only to inherited tools: it filters the set inherited from above, not the tools the scope registers itself.
- Multiple restrictions intersect: stacked restrictions only narrow the set, never widen it — the same idea as the pipeline's monotonic policy.
- Sub-scopes therefore have their own view: a delegated sub-agent can work in a narrower set while still keeping the tools it needs to report back — which is exactly why its own registrations are not constrained.
Notes on the tool pipeline
Read a tool as "schema + execute function + wrapping pipeline" and things stop blurring.
- The model only sees the schema: descriptions and parameters are the model-visible part; execution details stay off the protocol.
outputcannot be omitted: the return value must be declared so results can be validated.- Registration is a trusted contract: the in-process registry validates schema and semantics; do not expect the system to rescue a non-conforming definition.
- Execution can be wrapped: the waterfall design leaves room for plugins to cooperate, and constraints can be tightened downstream.
- Visibility can be narrowed per scope:
ToolRestrictiondecides which inherited tools a scope sees, and multiple restrictions intersect. - More tools, longer prefix: registering a tool adds both capability and context cost, so weigh them together.
- For the built-in list, see the how-to: which tools exist is in built-in tools; where tools sit in the chain is in how one turn runs.
Source: DeepSeek Harness docs - tools subsystem, docs - core subsystems.
FAQ
**A tool in DeepSeek Harness is a ToolDefinition: a schema plus an execute function, with the output declaration required.** The schema describes the parameters and the return value, which is the part the model can see, while the execute function receives a frozen snapshot of arguments and returns a value that matches the output declaration.
**DeepSeek Harness uses the same JSON value schema DSL for a tool's parameters and its output, so the author declares types with one vocabulary.** At compile time it is turned into a supported subset of raw JSON Schema, covering string, number, integer, boolean, null, array, object and oneOf, with unsupported keywords rejected rather than accepted but unenforced.
**The model knows which tools exist because each tool's schema is projected into the system prompt prefix, not because it sees the registration itself.** DeepSeek Harness projects the resolved definition out of the registry, so a newly registered DSH plugin tool becomes visible in later turns and adds to prefix length.
**Tool execution in DeepSeek Harness runs through an extensible waterfall pipeline that applies monotonic policy.** Plugins can wrap the execution before and after the actual function without touching the tool itself, and because policy only tightens downstream, constraints accumulate rather than cancel out.
**ToolRestriction is a scope's live filter over the tools it inherits, narrowing the visible set by name while leaving that scope's own registrations untouched.** Multiple restrictions intersect, so a delegated sub-agent can work in a narrower tool set while still keeping the tools it needs to report back.
Related Terms
- ToolDefinition
- A ToolDefinition is what a registered tool is in DeepSeek Harness: a schema plus an execute function, with the output declaration required so results can be validated.— DeepSeek Harness docs - tools subsystem
- output
- output is the required return-value declaration of a DeepSeek Harness tool; the execute function returns a value matching it, so what the model receives is predictable.— DeepSeek Harness docs - tools subsystem
- ToolRestriction
- ToolRestriction is a scope-level live filter in DeepSeek Harness that narrows the inherited tool set by name; multiple restrictions intersect and a scope's own registrations are unaffected.— DeepSeek Harness docs - tools subsystem
- ctx.tools
- ctx.tools is the service entry for the tool runtime in DeepSeek Harness: registration, schema projection and dispatch all go through it, so plugins join the lifecycle without editing the core.— DeepSeek Harness docs - tools subsystem
Sources
- DeepSeek Harness docs - tools subsystem· deepseek-harness
- DeepSeek Harness docs - core subsystems· deepseek-harness