Skip to main content
Glama

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

NameRequiredDescriptionDefault
envNoConfig branch: which `environment` rows of the AI config DB to read/write. staging = the editable working set (default); prod = what production serves.staging
idsNodiff: the pair as [version_id_a, version_id_b] (prompt_version_id UUIDs).
slugNopublish_from_repo: agent_prompts slug to resolve the prompt_id from (with profile_id).
notesNoNotes for the new version (publish_from_repo default: carry the served version's notes).
actionYesOperation to run: get | list | list_versions | create_version | serve | diff | publish_from_repo. The tool description lists what each action needs.
confirmNofalse (default) = dry run, nothing changes; true = execute.
contentNocreate_version: the full prompt text.
constantNoDotted path of a repo prompt constant under runtime.prompts, e.g. runtime.prompts.agents_demo.SUPPORT_SYSTEM_PROMPT.
max_charsNoget: truncate content to this many chars (0 = full text).
prompt_idNoagent_prompts UUID (a prompt slot; prompts action=list).
version_aNoFirst prompt version NUMBER (or use ids=[uuid_a, uuid_b]).
version_bNoSecond prompt version NUMBER (or use ids=[uuid_a, uuid_b]).
agent_kindNolist: list every prompt slot of this agent_kind.
profile_idNoAgent profile UUID (list_profiles / get_profile).
prompt_keyNoPrompt slot on the profile, e.g. system, voice_persona.system
version_idNoagent_prompt_versions UUID (get / serve).
version_numberNoget: version number within prompt_id (0 = newest).
include_contentNodiff: also return both full bodies (default: unified diff + stats only).
override_validationNoWrite even though prompt validation failed (needs confirm=true; audited).

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.9/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full behavioral burden and does so: validation gates for every write path, error shape, dry-run/confirm semantics, already_current short-circuit, 400-line diff cap, max_chars truncation, and audited override_validation. It also clarifies that create_version/serve run only the universal imperative check while publish_from_repo gets the full provenance-aware validation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The action list is front-loaded and scannable, and most detail is necessary for a seven-action mutation-prone tool. It is still dense and somewhat repetitive in the validation/override section, so trimming some parentheticals and module-path asides would improve scanability.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 19-parameter tool with an output schema and no annotations, the description covers all action modes, write-validation behavior, dry-run outcomes, and override auditing. Nothing essential for selecting or safely invoking an action appears missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is already 100%, but the description adds action-specific parameter semantics that the schema cannot: alternative targeting paths, default version_number newest, notes inheritance from the served version, prompt_key default, and the confirm+override_validation two-flag rule. These details materially reduce invocation errors for a 19-parameter tool.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Opens with a specific resource scope ('Prompt text + prompt-version operations') and immediately breaks the seven action values into concrete verbs and required identifiers. It explicitly routes rewrite work to prompt_optimize, so siblings are distinguishable.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Every action has a when-to-use statement: get for full text, list for previews, list_versions for metadata only, create_version for new content, serve to pin, diff to compare, and publish_from_repo to import a repo constant. The description also names prompt_optimize as the alternative for eval-driven rewrites and explains why publish_from_repo exists instead of passing content through the client.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.