get-prompt-by-identifier
Retrieve the latest version of a prompt by its identifier, including its template, model configuration, and invocation parameters, ensuring accurate deployment and usage.
Instructions
Get a prompt's latest version by its identifier (name or ID). Returns the prompt version with its template, model configuration, and invocation parameters.
Example usage: Get the latest version of a prompt with name '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
- Handler function that fetches the latest prompt version by the given prompt_identifier using the PhoenixClient API and returns the JSON-stringified response.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:298-322 (registration)Registers the 'get-prompt-by-identifier' MCP tool with description, input schema, and inline handler function.server.tool( "get-prompt-by-identifier", GET_PROMPT_BY_IDENTIFIER_DESCRIPTION, getPromptByIdentifierSchema.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: an object with a required 'prompt_identifier' string field.export const getPromptByIdentifierSchema = z.object({ prompt_identifier: z.string(), });