Skip to main content
Glama

migrate_prompt

Idempotent

Idempotently migrate prompts by name within a collection: creates new prompts, adds versions on content change, skips if unchanged. Dry run reports actions without making changes.

Instructions

Create or update a prompt in one idempotent step for CI/CD and prompt-as-code flows, unlike create_prompt which always makes a new prompt. Looks up the prompt by name within collection_id: if missing it creates the prompt, if found with different content it adds a new version (nothing is overwritten), and if the content already matches it no-ops; dry_run reports what would happen without changing anything. Stores app/env in template_metadata; get collection_id from list_collections. Returns the action taken (created, updated, or unchanged), dry_run flag, message, prompt id, slug, and version id.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
appYesApp identifier (REQUIRED). Use your deployed app name, for example 'hourlink' or 'support-console'.
envYesEnvironment identifier (REQUIRED). Use your environment name, for example 'dev', 'staging', 'prod', or 'qa'.
nameYesPrompt name to create or find for update
modelNoModel identifier
toolsNoTool definitions
stringNoLegacy prompt template string with {{variable}} mustache syntax.
dry_runNoWhen true, only check what action would be taken without making changes
messagesNoStructured chat template alias for migrations. Serialized to the legacy string format before the prompt is created or updated.
functionsNoFunction definitions
parametersYesDefault values for template variables
tool_choiceNoTool choice strategy
virtual_keyYesVirtual key slug for model access
collection_idYesCollection ID to search in and create under
template_metadataNoAdditional custom metadata
version_descriptionNoDescription for this version

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
okYesWhether the tool call succeeded and returned structured data
dataNoStructured success payload when ok is true
errorNoStructured error payload when ok is false
Behavior5/5

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

Annotations already set `idempotentHint=true` and `destructiveHint=false`. The description goes beyond by explaining that 'nothing is overwritten' and that if content matches, it 'no-ops'. It also details the dry_run behavior ('reports what would happen without changing anything') and what the tool stores in template_metadata (app/env). This adds valuable behavioral context.

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

Conciseness5/5

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

The description is a single, dense paragraph that wastes no words. Each sentence adds value: purpose, contrast with sibling, behavior, dry_run, metadata, return fields. It is front-loaded with the most critical information and remains brief given the tool's complexity (15 params).

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

Completeness4/5

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

Given the tool's high parameter count and nested objects, the description covers the core idempotent behavior, dry_run, key parameters, and return fields. It mentions that `messages` are serialized to legacy string format but does not detail the exact serialization process. However, the output schema likely describes return values. Minor gap, but overall sufficient for agent selection and invocation.

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. The description adds meaning by noting that `collection_id` is used for lookup and creation, `dry_run` controls dry-run mode, and `template_metadata` stores app/env. However, it omits explanation for some parameters like `model`, `tools`, `messages`, and `string`. Still, the provided details enhance understanding beyond the schema.

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?

The description clearly states the tool's purpose: 'Create or update a prompt in one idempotent step for CI/CD and prompt-as-code flows'. It immediately distinguishes from `create_prompt`, which always creates a new prompt. The verb 'migrate' combined with the explanation of idempotent upsert behavior makes the purpose precise and actionable.

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?

The description explicitly tells when to use this tool versus the sibling `create_prompt` ('unlike create_prompt which always makes a new prompt'). It also explains the lookup logic by name within collection_id, the three possible outcomes (create, update, no-op), and the dry_run flag for safe testing. It directs the user to `list_collections` for obtaining collection_id.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/CodesWhat/portkey-admin-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server