Skip to content

buildGrantedToolsGuidance

buildGrantedToolsGuidance(grantedTools): string | null

Defined in: _worktrees/docs-release/gaunt-sloth/packages/core/src/core/shell/rater.ts:707

EXT-58 (spec §4.4) — the granted-alternative section of the rating prompt, built from the already-granted built-in tools of the current rung.

Three properties are normative and each is spelled out to the rater:

  • It must name a granted tool whenever the outcome is not safe and one of them would do the job, because a free built-in call beats an interruption.
  • It must not name one when none can do the job — a path outside the working folder is the canonical case, where neither the read nor the edit tool can reach either. A facility that manufactures suggestions makes “a suggestion is never an approval” meaningless.
  • A suggestion is never an approval: it does not change the outcome, does not approve the original command, and does not pre-approve the suggested tool (which is gated normally when it arrives). The gate enforces this structurally — mapVerdictToAction never reads the field — but the rater is told so it does not soften an outcome because an alternative exists.

The list is trusted, locally-generated text (§4.3) and therefore lives in the SYSTEM prompt, structurally outside the <command_to_evaluate> block that carries the untrusted command. Only tool names and one-line descriptions authored in config/tool-descriptions.ts ever appear here; no MCP/custom/A2A tool’s own description can reach the rater.

Returns null when nothing is granted (or the caller supplied no list), so the prompt is exactly the pre-EXT-58 text and the rater is never invited to invent a tool out of an empty list.

readonly GrantedToolSummary[] | undefined

string | null