get-latest-prompt
Retrieve the current version of a prompt with its template, model configuration, and invocation parameters for consistent AI interactions.
Instructions
Get the latest version of a prompt. Returns the prompt version with its template, model configuration, and invocation parameters.
Example usage: Get the latest version of a prompt named 'article-summarizer'
Expected return: Prompt version object with template and configuration. Example: { "description": "Initial version", "model_provider": "OPENAI", "model_name": "gpt-3.5-turbo", "template": { "type": "chat", "messages": [ { "role": "system", "content": "You are an expert summarizer. Create clear, concise bullet points highlighting the key information." }, { "role": "user", "content": "Please summarize the following {{topic}} article:
{{article}}" } ] }, "template_type": "CHAT", "template_format": "MUSTACHE", "invocation_parameters": { "type": "openai", "openai": {} }, "id": "promptversionid1234" }
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| prompt_identifier | Yes |
Implementation Reference
- The core handler function for the 'get-latest-prompt' tool. It uses the PhoenixClient to fetch the latest version of the specified prompt via the API endpoint "/v1/prompts/{prompt_identifier}/latest" and returns the response data as formatted JSON text.async ({ prompt_identifier }) => { const response = await client.GET( "/v1/prompts/{prompt_identifier}/latest", { params: { path: { prompt_identifier, }, }, } ); return { content: [ { type: "text", text: JSON.stringify(response.data, null, 2), }, ], }; }
- js/packages/phoenix-mcp/src/promptTools.ts:273-296 (registration)Registers the 'get-latest-prompt' tool on the MCP server, providing the name, description, input schema, and handler function."get-latest-prompt", GET_LATEST_PROMPT_DESCRIPTION, getLatestPromptSchema.shape, async ({ prompt_identifier }) => { const response = await client.GET( "/v1/prompts/{prompt_identifier}/latest", { params: { path: { prompt_identifier, }, }, } ); return { content: [ { type: "text", text: JSON.stringify(response.data, null, 2), }, ], }; } );
- Zod schema defining the input for the tool: requires a 'prompt_identifier' string (name or ID of the prompt).export const getLatestPromptSchema = z.object({ prompt_identifier: z.string(), });
- js/packages/phoenix-mcp/src/index.ts:40-40 (registration)Calls the initialization function that registers the prompt tools, including 'get-latest-prompt', on the MCP server instance.initializePromptTools({ client, server });