Skip to content

v0.x: a tool can withhold any command from MCP, and BindingOptions takes Props

Spec 0213.

What changed

props.MCPConfig has a Withhold field. It is a list of slash-separated command paths from the root, such as config/trust. A command whose path, or an ancestor's path, is listed is not an MCP operation, and no annotation overrules that, setup.IncludeInMCP included. An empty list is the behaviour before this change. props.New refuses a path with an empty or whitespace-holding segment.

A slice field means props.MCPConfig, and the generator's ManifestMCP, can no longer be compared with ==. Compare the Mode fields.

pkg/mcp.BindingOptions takes the tool's Props. It reads the list from p.Tool.MCP.Withhold:

// before
opts := gtbmcp.BindingOptions()

// after
opts := gtbmcp.BindingOptions(p)

A listed path that names no command stops the tool serving MCP. mcp start, mcp stream and mcp tools return mcp.ErrWithheldPathNotFound naming each such path. A path whose first segment is a feature the tool has turned off is not reported. A deeper command that a feature adds, such as docs/ask while ai is off, is.

gtb disable mcp <path> and gtb enable mcp <path> accept a path gtb did not generate. Both used to fail with command <path> not found in manifest. Now disable puts such a path on properties.mcp.withhold and re-renders the root, and enable takes it off, or says the command is already exposed when the path was never listed. A path with an entry in commands: behaves as before.

What you need to do

  • If you call pkg/mcp.BindingOptions yourself, pass your *props.Props. Nothing in go-tool-base calls it outside pkg/mcp, so a tool that takes the mcp command from the link is unaffected.
  • If you compare two props.MCPConfig values with ==, the compiler now refuses it. Compare Mode, or use reflect.DeepEqual.
  • If a script relied on gtb disable mcp <path> failing for an unknown path, it no longer does. A mistyped name of a generated command is now put on the list. The built tool refuses to serve MCP until the path is corrected or removed with gtb enable mcp <path>, so the mistake still surfaces, at the first mcp tools and not at the gtb call.
  • Otherwise nothing. A generated project picks up the field on its next regenerate, and renders it only when the list is not empty.

Withholding a command

gtb disable mcp sign config/trust

See enable and disable for the rules, and AI Agents & MCP for why the list beats a module's own marker.