DeepSeek Harness

DeepSeek Harness: Can MCP Tools Load Lazily?

· 8 min read · 中文版

DeepSeek Harness users have proposed deferred loading for large MCP tool catalogs, but the cited discussion describes a feature request and a user-built workaround, not a documented switch that enables the complete flow.

DeepSeek Harness: Why can a large catalog cost so much context?

The memory MCP guide describes DSH connecting to a configured stdio or Streamable HTTP server, discovering its tools and exposing them as mcp__<serverName>__<tool>. Discovery makes an integration usable, but the guide does not document a general option to defer the schemas of a large MCP catalog.

In discussion #10812, a user reports that the MCP client registers every discovered tool and the registry sends every visible schema with each request. Their example is REA 6.7.0 with 207 tools and roughly 668 KB of input schemas. On DSH 0.2.0-rc.2, the author reports 249,653 input tokens on the first request of a headless session, with the prefix repeated later. These are measurements from one user's setup, not a universal cost or a guarantee about a later release.

The practical problem is the amount of context occupied before the model has selected the few tools a task needs. The author notes that cache hits can reduce cost while the prefix still occupies context. A server being connected, a tool being discovered, and its schema being included in a model request are different stages; investigate which stage causes the observed problem before changing an integration.

Compare MCP discovery, the proposed deferred flow and the reported proxy workaround

DeepSeek Harness: What did the user test at the endpoint?

The discussion reports tests on October 23, 2026 against the DeepSeek Anthropic-compatible messages endpoint with deepseek-flash and deepseek-v4-pro. These are the author's reported results, not independent verification or a promise that another model, endpoint or version behaves identically.

Request in the reportReported resultWhat it means for the proposal
Server-side BM25 or regex tool search variantHTTP 422, unknown variantThe author did not find that server-side search available in this test
All tools marked defer_loading: trueHTTP 400The endpoint required at least one non-deferred tool in that test
One regular tool and 150 deferred large tools166 input tokens; 261,938 without deferralThe author measured a large difference under these specific conditions
Client-side search returning tool_referenceHTTP 200, followed by ordinary tool useThe author observed a possible reference-based activation path

The reported result used a tool result containing an object shaped like {"type":"tool_reference","tool_name":"<deferred tool>"}. According to the author, the tools array stayed fixed, and the next turn invoked the referenced tool. The discussion includes a reproduction script; its results depend on the endpoint, models, credentials, request and time. Do not copy the placeholder tool name as though it were a working tool in your installation.

This endpoint experiment is not itself an end-to-end Harness feature. Support for a wire representation at a model endpoint, the Harness adapter's ability to serialize it, and MCP registration behavior must all align. A result from one layer cannot establish the others.

DeepSeek Harness: What is proposed and what is missing?

The discussion author says ToolSchema.deferLoading already serializes to defer_loading, but the tested Harness activates a deferred tool through a tool-addition developer message. The author also reports that, in 0.2.0-rc.2 and the cited master revision, the DeepSeek adapter's tool-result input accepts text and images but has no Harness block mapping to tool_reference; the MCP client has no option to register discovered tools as deferred. These are version-specific user observations.

The proposed changes span three layers:

  1. Add a Harness tool-result reference block, preserve it in the log for exact replay, and serialize it into the endpoint's tool_reference representation where supported.
  2. Advertise route capability so the registry or a plugin can determine whether references are supported. The author suggests a text projection for routes unable to carry the block.
  3. Add an opt-in deferLoading: true on MCP client rows and a small search tool that returns references.

The last item is a proposal, not a configuration recipe established by the memory guide. Setting that key based solely on the discussion should not be presented as an available fix. Similarly, the author's claim that mid-conversation tool_addition breaks sessions on the tested official endpoint is a report linked to other discussions, not proof of behavior for every deployment.

The distinction matters for replay as well as initial requests. If a reference is part of a tool result, a future implementation needs a faithful record and a route-specific representation. The proposal identifies those concerns; it does not establish that the feature has been merged, released or enabled by default.

DeepSeek Harness: What can you do while evaluating the problem?

The author describes a separate plugin workaround: keep a compact family index in the system prompt and expose fixed capability_search, capability_describe and capability_call proxy tools. The proxy validates arguments against the original schemas and forwards calls to MCP. The author reports roughly 9.2k input tokens for the first request of the same headless task, compared with 249,653 before the workaround. They also report an extra step per tool and loss of native tool calls. These are claims about their implementation and experiment, not a built-in DSH feature or a predicted saving for your workload.

To investigate your own setup:

  1. Record the DSH, provider, model and MCP server versions, transport and task. Count the discovered tools and retain the first request's usage evidence if your deployment exposes it.
  2. Identify which integrations are necessary for the task. The memory guide's reference overlays are default-off and no memory server is present in the shipped composition; selecting an overlay connects that particular server, not a global lazy-loading mechanism.
  3. Compare a representative task with and without the relevant integration in a suitable test environment. Keep model, prompt and other conditions as consistent as practical, and record both token usage and whether the task can still find and use the needed capability.
  4. If evaluating a third-party proxy, inspect its source, dependencies, permissions and behavior; test argument validation, errors and tool results with non-sensitive data. Account for extra steps and changed tool-call semantics.
  5. Check the discussion and current documentation for the installed version before concluding that a proposed setting or adapter behavior is available. Document the observed configuration and keep a way to restore the earlier setup.

A useful comparison also records whether the model chose the expected tool and whether the returned result was usable. A smaller request that cannot complete the same task is not an equivalent outcome.

Do not confuse initial asynchronous discovery with deferred schema loading. The memory guide says to wait for a provider's mcp__... tools before the first validation prompt. It also describes reconnect and re-sync after a crashed child, with calls failing during an outage and eventual unregistration if the reconnect budget is exhausted. These lifecycle behaviors do not establish the proposed reference mechanism.

DeepSeek Harness: What are the limits and safety boundaries?

The memory guide's examples are interoperability references, not endorsements of third-party servers. DSH does not install the server, create its account, initialize its database or supervise a separate HTTP service. For stdio it starts and stops the child with the plugin lifecycle; for HTTP the upstream service must already be running. Evaluate the server's own data handling and access separately.

The stdio bridge removes ambient variables whose names usually indicate credentials and all DSH_* variables, but other ambient variables remain inherited. The guide says additional required secrets belong in the row's config.env, not as literal secrets in YAML. Tool discovery or a proxy's argument validation does not make a server, command or returned content safe. Review what a capability can access and sanitize logs and experiments.

The discussion provides a useful design and reproducible claim, but it is not release documentation. Recheck implementation status and measure your own workload before relying on its token figures or proposed APIs. A lower token count alone does not establish that all required tools remain discoverable or that the resulting task is correct.

DeepSeek Harness: What do the terms mean?

  • MCP server: a separate provider exposing tools to a client.
  • Discovery: finding the tools offered by a configured server.
  • Schema: the description of a tool's input accepted by the model or proxy.
  • Deferred tool: a tool whose full loading is postponed in the reported endpoint experiment.
  • Tool reference: the reported result block identifying a deferred tool for activation.
  • Proxy: a middle layer that exposes fixed operations and forwards selected calls.

Frequently asked questions

Is deferLoading a documented MCP client setting?

The cited discussion proposes it; the memory guide does not document it as an available setting.

Does asynchronous discovery mean lazy schema loading?

No. The guide describes discovery timing, not the proposed reference-based deferral.

Are the reported token savings guaranteed?

No. They are user measurements from a specific setup and task.

Sources

Every claim in this article was checked against the sources below. Community discussions are user reports, not official behavior.

  1. Discussion #10812
  2. Connect a third-party memory MCP server

This is an independent community article, not official DeepSeek documentation. Listing a plugin in the registry is not a security review.

← Back to all articles

DeepSeek Harness: Can MCP Tools Load Lazily?