Skip to main content
Glama

profile_versions

Manage per-environment agent profile versions: list, view, save, restore, pin the served version, and diff changes to audit or roll back configuration.

Instructions

Per-(profile, environment) version history + served-version pin — the MCP surface for the agents screen's version bar (save / view / pin / restore), delegating to admin.services.profile_versions so the portal and MCP stay in lockstep (the eval-work lesson). Mixed read/write (list/view read; save/restore/pin mutate) — left unannotated rather than READ_ONLY, same reasoning as prompts/models/tools.

action:
  list — version history for profile_id in env, newest first:
    [{version_id, version_number, promoted_at, notes, is_served}].
  view (version_id) — that version's resolved config snapshot.
    version_id must belong to profile_id (same ownership guard
    restore/pin use) — errors otherwise.
  save (notes optional) — snapshot the profile's CURRENT live/draft
    config into a brand-new version via the same
    runtime.compiler.compile_profile_snapshot promote uses; does NOT
    change what's served. Returns {version_id, version_number}.
  restore (version_id) — copy that version's config back onto the live
    draft row (identity fields agent_kind/slug/display_name/
    description untouched), filtering out any tool/data-source/
    MCP-server/model/prompt-version reference that no longer exists in
    this env (reported in `dropped`); never changes served_version_id
    — save afterwards to turn "editing a copy of vN" into a new
    version. Returns {restored, dropped}.
  pin (version_id, or "" to clear) — set/clear
    agent_profiles.served_version_id, the exact
    agent_profile_versions snapshot AgentProfileLoader serves for this
    profile+env (clearing reverts to default resolution). Returns
    {served_version_id}.
  diff (version_id → that version vs the LIVE/draft row; or
    ids=[version_a, version_b] → two saved versions) — the portal's
    version-diff view: {changes: ["model_main_id: 'x' -> 'y'",
    "tools: +a, -b", ...]}; include_detail=true adds the full
    structured diff. Read-only.

All writes run inside use_env(env) so reused portal service code
resolves the right env branch, and are audited by
admin.services.profile_versions itself (its own record_change calls —
no separate MCP-level audit, so a save/restore/pin produces exactly
one audit_log row, not two). ValueError from the service layer
(profile/version not found, or a version_id that belongs to a
different profile) surfaces as the standard err() payload via
@tool_errors.

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>",
      "profile_id": "<profile_id>"
    },
    "name": "profile_versions"
  }
}

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: [version_a, version_b] to diff two saved versions (instead of version_id vs the live row).
notesNosave: notes stored with the version.
actionYesOperation to run: list | view | save | restore | pin | diff. The tool description lists what each action needs.
profile_idYesAgent profile UUID (list_profiles / get_profile).
version_idNoagent_profile_versions UUID.
include_detailNodiff: also return the full structured diff (default: summary lines only).

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.6/5.0
Behavior5/5

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

Carries the full burden since no annotations exist and discloses exactly what an agent needs: restore never mutates served_version_id, save does not change what is served, missing references are silently dropped and reported in `dropped`, writes run inside use_env(env), and each write produces exactly one audit_log row (not two). It also documents that service-layer ValueError surfaces as the standard err() payload.

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 per-action bullet list is well front-loaded and scannable, and most sentences carry operational weight. Some internal-rationale phrases ('so the portal and MCP stay in lockstep (the eval-work lesson)', 'same reasoning as prompts/models/tools') add noise an agent doesn't need.

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 7-parameter, 6-action mixed read/write tool with no annotations, the description covers every action's inputs, side effects, error path, and audit behavior. Output values are named even though an output schema exists, leaving nothing an agent needs in order to call it correctly.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3, but the description adds real meaning the schema lacks: version_id must belong to profile_id (same ownership guard as restore/pin, errors otherwise), pin accepts "" to clear, ids takes two saved versions for diff, and include_detail expands the structured diff.

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 verb-and-resource frame: 'Per-(profile, environment) version history + served-version pin' and names the exact user surface it maps to. The six enumerated actions make the scope unambiguous and distinguish it from fork_profile/promote_profile/diff_profiles by describing what each does here.

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

Usage Guidelines4/5

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

Each action has explicit usage context — save snapshots live config without changing what's served, restore requires a follow-up save to create a new version, pin with an empty string clears to default resolution. It does not explicitly route the agent away from the sibling diff_profiles or explain how this differs from promote_profile, so it stops short of full when-not/alternatives guidance.

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