Create or update a prompt in one idempotent step for CI/CD and prompt-as-code flows. Finds existing prompts by name within the collection, stores app/env in template_metadata, and supports dry_run for safe preflight checks.
AI agents use migrate_prompt to create or update resources in Portkey Admin — usually the action step of a workflow, after the agent has gathered context. Every call changes real data in your Portkey Admin environment.
| Parameter | Type | Required | Description |
|---|---|---|---|
app | string | Yes | App identifier (REQUIRED). Use your deployed app name, for example 'hourlink' or 'support-console'. |
env | string | Yes | Environment identifier (REQUIRED). Use your environment name, for example 'dev', 'staging', 'prod', or 'qa'. |
name | string | Yes | Prompt name to create or find for update |
model | string | — | Model identifier |
tools | array | — | Tool definitions |
string | string | — | Legacy prompt template string with {{variable}} mustache syntax. |
dry_run | boolean | — | When true, only check what action would be taken without making changes |
messages | array | — | Structured chat template alias for migrations. Serialized to the legacy string format before the prompt is created or updated. |
functions | array | — | Function definitions |
parameters | object | Yes | Default values for template variables |
tool_choice | object | — | Tool choice strategy |
virtual_key | string | Yes | Virtual key slug for model access |
Parameters from the server's own tool schema.
An AI agent can call migrate_prompt faster than any human can review — one bad instruction and it creates or modifies resources in Portkey Admin by the hundred, each call as confident as the last.
Risk signalsAccepts raw HTML/template content (messages[].content) · High parameter count (29 properties)
Attacks that exploit this kind of access
Create or update a prompt in one idempotent step for CI/CD and prompt-as-code flows. Finds existing prompts by name within the collection, stores app/env in template_metadata, and supports dry_run for safe preflight checks. It is categorised as a Write tool in the Portkey Admin MCP Server, which means it can create or modify data. Consider rate limits to prevent runaway writes.
migrate_prompt accepts 12 parameters: app, env, name, model, tools, string, dry_run, messages, functions, parameters, tool_choice, virtual_key. Required: app, env, name, parameters, virtual_key. The full parameter table on this page comes from the server's own tool schema.
Register the Portkey Admin MCP server in PolicyLayer and add a rule for migrate_prompt: allow, deny, rate-limit, or require approval. Point your MCP client at the PolicyLayer proxy URL and the rule is enforced on every call, before it reaches Portkey Admin. Nothing to install.
migrate_prompt is a Write tool with medium risk. Write tools should be rate-limited to prevent accidental bulk modifications.
Yes. Add a rate_limit block to the migrate_prompt rule in your PolicyLayer policy. For example, setting max: 10 and window: 60 limits the tool to 10 calls per minute. Rate limits are tracked per agent session and reset automatically.
Set action: deny in the PolicyLayer policy for migrate_prompt. The AI agent will receive a policy violation error and cannot call the tool. You can also include a reason field to explain why the tool is blocked.
migrate_prompt is provided by the Portkey Admin MCP server (CodesWhat/portkey-admin-mcp). PolicyLayer sits as a proxy in front of this server to enforce policies before tool calls reach the server.