prompts
Read prompt text, list versions pinned to a profile, diff two versions, and publish or repoint repo prompt constants with validation gating every write.
Instructions
Prompt text + prompt-version operations. action: get — the FULL TEXT of one version: by version_id | prompt_id (+ version_number, default newest) | profile_id + prompt_key (the version that profile SERVES — what callers actually get). Returns {prompt_id, slug, agent_kind, version_number, prompt_version_id, content, notes, chars, is_served?}. max_chars truncates. list — prompt slots with short previews: profile_id → that profile's pinned prompts (key, version, preview); agent_kind → every agent_prompts slot of that kind with its newest version's preview; prompt_id → that prompt's versions with previews. list_versions (prompt_id) — versions without content (legacy shape). create_version (prompt_id, content, notes; for a custom agent pass profile_id + content instead — its own prompt is used and the new version is pinned in the same call) | serve (pin a version on a profile: profile_id, prompt_key, version_id) | diff — ids=[version_id_a, version_id_b] (or prompt_id + version_a + version_b numbers): a unified diff (capped at 400 lines) + diff_stat; include_content=true adds both bodies | publish_from_repo (see below). To rewrite a prompt from a failing eval run, use the prompt_optimize tool.
publish_from_repo is the way to get a repo prompt constant onto a live
stack: it imports the constant itself (so a half-Arabic body never
passes through the MCP client/shell, where quoting would corrupt it),
diffs it against what's actually served, and — with confirm — inserts
the new version and repoints in one call.
Params: `constant` (dotted path, must resolve under the
`runtime.prompts` package — e.g.
"runtime.prompts.agents_demo.SUPPORT_SYSTEM_PROMPT"); `prompt_id` to target
directly, OR `profile_id` + `slug` to resolve one (looked up as the
`agent_prompts` row for `(that profile's agent_kind, slug)`, same
(agent_kind, slug) keying seed_prompts.py uses); `profile_id` +
`prompt_key` (default "system") for the repoint target; `notes`
(optional — if omitted, the CURRENTLY SERVED version's notes are
carried onto the new one, so publishing a chat prompt fix never
accidentally reuses a voice profile's notes string or vice versa, a
known seeding gotcha); `confirm` (default False).
Behavior: if the served version's content already equals the constant,
returns `{"already_current": True, ...}` and writes nothing. Without
confirm, returns a dry run — current version number/id, a `diff_stat`
(char counts + first differing line — never the prompt body), AND a
`validation` block (the same problems a confirmed call would be
checked against, so a human sees red flags before deciding to
confirm). With confirm, VALIDATES the constant's content
(core.prompt_validator.validate_prompt) before writing anything —
inserts version N+1 via the same path create_version uses and
repoints via the same path serve uses, and returns
`{"published": True, ...}`.
VALIDATION GATES EVERY WRITE PATH — create_version, serve and
publish_from_repo's confirm branch all run
`core.prompt_validator.validate_prompt` before writing. An
error-severity problem (a size-budget breach, a missing/reverted
bilingual half, or a descriptive-instead-of-imperative `ask_agent`
instruction — see that module) REFUSES the write and returns
`{"error": ..., "problems": [...]}` with nothing inserted or repointed.
`serve` is included deliberately: pinning an existing bad version onto
a profile is the same failure as publishing a new bad one.
`override_validation` (default False) forces a write through a
validation failure. It is deliberately a TWO-flag act — it does
nothing without `confirm=true` too — and every override is recorded
via `actor_audit` (action="validation_override", carrying the full
problem list) so a forced publish stays visible in the audit trail
even though it succeeded. `create_version` and `serve` validate with no
named repo constant to check size/bilingual rules against (they accept
arbitrary content with no such provenance) — only the universal
`ask_agent`-imperative rule runs there; `publish_from_repo` resolves a
canonical name from `constant` and gets the full check.Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"action": "<action>"
},
"name": "prompts"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| env | No | Config branch: which `environment` rows of the AI config DB to read/write. staging = the editable working set (default); prod = what production serves. | staging |
| ids | No | diff: the pair as [version_id_a, version_id_b] (prompt_version_id UUIDs). | |
| slug | No | publish_from_repo: agent_prompts slug to resolve the prompt_id from (with profile_id). | |
| notes | No | Notes for the new version (publish_from_repo default: carry the served version's notes). | |
| action | Yes | Operation to run: get | list | list_versions | create_version | serve | diff | publish_from_repo. The tool description lists what each action needs. | |
| confirm | No | false (default) = dry run, nothing changes; true = execute. | |
| content | No | create_version: the full prompt text. | |
| constant | No | Dotted path of a repo prompt constant under runtime.prompts, e.g. runtime.prompts.agents_demo.SUPPORT_SYSTEM_PROMPT. | |
| max_chars | No | get: truncate content to this many chars (0 = full text). | |
| prompt_id | No | agent_prompts UUID (a prompt slot; prompts action=list). | |
| version_a | No | First prompt version NUMBER (or use ids=[uuid_a, uuid_b]). | |
| version_b | No | Second prompt version NUMBER (or use ids=[uuid_a, uuid_b]). | |
| agent_kind | No | list: list every prompt slot of this agent_kind. | |
| profile_id | No | Agent profile UUID (list_profiles / get_profile). | |
| prompt_key | No | Prompt slot on the profile, e.g. system, voice_persona. | system |
| version_id | No | agent_prompt_versions UUID (get / serve). | |
| version_number | No | get: version number within prompt_id (0 = newest). | |
| include_content | No | diff: also return both full bodies (default: unified diff + stats only). | |
| override_validation | No | Write even though prompt validation failed (needs confirm=true; audited). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |