In DeepSeek Harness (DSH) agent development, model context length is usually limited. When a project contains many tools, injecting all tool schemas into model requests consumes extra tokens and may even cause context overflow or request failure. The @rayfalling/dsh-tool-visibility plugin aims to solve this problem by allowing developers to statically control which tool schemas are injected into the model context.

Plugin Positioning

This is a static DSH plugin maintained by rayfalling and categorized under admin-security. It provides a settings page UI and model-side management tools, working with the framework’s native tools.restrict filtering mechanism to achieve global control over tool injection.

Core Features

  • Settings page UI: Adds a “Tool Injection Control” entry in browser settings, supporting per-tool toggles, filtering by name-prefix groups, search, and batch operations for entire groups.
  • Management tool: Provides the tool_visibility management tool, supporting commands such as list, hide, show, and reset.
  • Native filtering: Prefers the DSH framework’s native ctx.tools.restrict({ deny}) filter.
  • Persistent state: The list of hidden tools is saved to a JSON file and automatically restored after restart.

Installation and Mounting

Install the plugin:

dsh plugin add @rayfalling/dsh-tool-visibility

Mount it in the agent preset configuration file (such as <preset>/agent.cordis.yml):

- id: tool-visibility
  name: '@rayfalling/dsh-tool-visibility'

How It Works

Before each model invocation, the plugin collects tool schemas via systemPrompt.assemble(). It uses two prioritized mechanisms to decide whether to inject them:

  1. ctx.tools.restrict({ deny}) (preferred): Takes effect when mounted as an agent preset. Restricted tool schemas are not injected into the context, and invoking them returns an UNKNOWN_TOOL error.
  2. system-prompt/assemble fallback: Enabled only when restrict is unavailable. It removes hidden schemas from the assembled result, affecting only what the model sees and not blocking tool execution.

Note: The tool_visibility management tool itself cannot be hidden.

Persistent Configuration

By default, the hidden-tool state is stored in $DSH_HOME/tool-visibility.json (usually ~/.dsh/tool-visibility.json). After each hide/show/reset operation, the state is written to disk.

The state file format is as follows:

{
  "hidden": ["import_claude", "store_search"],
  "descriptions": {
    "import_claude": "..."
  }
}

You can also customize the state file path:

- id: tool-visibility
  name: '@rayfalling/dsh-tool-visibility'
  config:
    stateFile: 'F:/my/state.json'

Notes

  • Version requirement: This plugin requires DSH version >= 0.1.5-rc.1 (based on cordis 4.0.2) to ensure Connection RPC compatibility.
  • Use cases: Suitable for tool-only plugins, used to remove unnecessary tool schemas from each model request and save context space.

Summary

Through the settings page and management tool, combined with the framework’s native tools.restrict filtering mechanism, this plugin provides fine-grained tool injection control for DSH. After installation, developers can easily manage tool visibility and optimize model context usage.

Repository: https://github.com/rayfalling/dsh-tool-visibility