publish_prompt
Make a specific prompt version the active default, instantly routing all callers to that version. Verify the version beforehand since no rollback is possible.
Instructions
Publish a specific version of a prompt as the active default, unlike promote_prompt which copies across environments or update_prompt which creates a new draft. This immediately routes all callers using the slug to that version and there is no rollback, so use list_prompt_versions to pick the version and update_prompt first if you need to create new content before promoting it.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| prompt_id | Yes | Prompt ID or slug to publish | |
| version | Yes | Version number to publish as the default |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | Yes | Whether the tool call succeeded and returned structured data | |
| data | No | Structured success payload when ok is true | |
| error | No | Structured error payload when ok is false |
Implementation Reference
- src/tools/prompts.tools.ts:751-778 (handler)MCP tool handler for 'publish_prompt'. Registers the tool with server.tool(), validates input via PROMPTS_TOOL_SCHEMAS.publishPrompt, calls service.prompts.publishPrompt() with prompt_id and version, returns a success JSON response.
// Publish prompt tool server.tool( "publish_prompt", "Publish a specific version of a prompt as the active default, unlike promote_prompt which copies across environments or update_prompt which creates a new draft. This immediately routes all callers using the slug to that version and there is no rollback, so use list_prompt_versions to pick the version and update_prompt first if you need to create new content before promoting it.", PROMPTS_TOOL_SCHEMAS.publishPrompt, async (params) => { await service.prompts.publishPrompt(params.prompt_id, { version: params.version, }); return { content: [ { type: "text", text: JSON.stringify( { message: `Successfully published version ${params.version} of prompt "${params.prompt_id}"`, prompt_id: params.prompt_id, published_version: params.version, success: true, }, null, 2, ), }, ], }; }, ); - src/tools/prompts.tools.ts:182-188 (schema)Input schema for publish_prompt tool: requires prompt_id (string) and version (positive number, coerced from string).
publishPrompt: { prompt_id: z.string().describe("Prompt ID or slug to publish"), version: z.coerce .number() .positive() .describe("Version number to publish as the default"), }, - Type definitions for PublishPromptRequest (version: number) and PublishPromptResponse (empty object).
// ===== Publish Prompt (Make Default) ===== export interface PublishPromptRequest { version: number; } export type PublishPromptResponse = Record<string, never>; - Service method that sends PUT /prompts/{promptId}/makeDefault with the version payload to publish a prompt version as the default.
async publishPrompt( promptId: string, data: PublishPromptRequest, ): Promise<PublishPromptResponse> { return this.put<PublishPromptResponse>( `/prompts/${this.encodePathSegment(promptId)}/makeDefault`, data, ); } - src/lib/mcp-server.ts:33-46 (registration)Server instructions reference publish_prompt in the prompt workflow documentation string.
const PACKAGE_VERSION = readPackageVersion(); const SERVER_INSTRUCTIONS = "Portkey Admin API server. Use list_* tools for discovery and get_* tools for details. " + "Analytics tools require time_of_generation_min/max. " + "Prompt workflows: create_prompt -> publish_prompt. " + "Always validate_completion_metadata before run_prompt_completion. " + "If the server is configured with only some domains, stay within that subset instead of assuming every Portkey admin tool is available."; function parseConfiguredToolDomains( rawValue: string | undefined = process.env.PORTKEY_TOOL_DOMAINS?.trim() || process.env.MCP_TOOL_DOMAINS?.trim(), ): ToolDomain[] | undefined { if (!rawValue) { return undefined;