Documentation
¶
Overview ¶
Package deferred knows the format of Claude Code's deferred-tools list.
Claude Code defers MCP tools: the `tools` array then carries only the built-ins and a placeholder, and the mcp__* names arrive in a message as a header line, one name per line, and a blank line. Each such list is a delta, so a request carries one per change and the declared set is all of them together.
The format lives here, and not in the dashboard, so a second reader (a filter, a proxy component) uses the same header text and the same end rules. A reader that ended a list in a different place would count a different set of tools.
Index ¶
Constants ¶
const Header = "The following deferred tools are now available via ToolSearch."
Header starts a list of deferred tools.
Claude Code also sends removals, in wording not yet captured, so a removed server stays in the set until the session ends.
const MaxNameLen = 128
MaxNameLen is the API's own documented limit for a tool name. dash's maxDeclName is this constant.
Variables ¶
This section is empty.
Functions ¶
func Regions ¶
Regions returns every deferred list in the RAW (still JSON-escaped) body, each as a sub-slice of body. It runs on every request, so it is byte searches only and copies nothing. A body without a list returns nil.
A region runs from the header to a blank line (`\n\n` in the escaped body), a closing `</system-reminder>` line, or the end of its JSON string, whichever is first. Both JSON spellings of the tag count: Claude Code writes it literally, an encoder that escapes HTML (Go's does) writes `\u003c/system-reminder\u003e`. Text after a closing tag (a date, another reminder) must not reach a caller's digest. budget bounds the bytes returned in total.
func Texts ¶
Texts returns the text that Claude Code itself sends and that holds a list: a user or system message's own text, never a tool result, which holds whatever a command printed. Messages without the header are skipped.
func TextsResponses ¶
TextsResponses is Texts for a Responses body: the `instructions` string, and the text of every user, system or developer item of `input`. As in Texts, a function_call_output (a tool result) is never read.
Types ¶
type List ¶
List is one parsed list: its tool names and the byte range of the list in the text.
func Lists ¶
Lists parses every valid list in text. The header must start a line, and every line up to the end of the list must be a bare tool name (ValidName). One line that is not voids that whole list, because a user can quote the header. It returns how many lists it voided, so a caller can log a format change instead of showing "0 MCP servers".