Skip to main content
The get_prompt tool retrieves complete details for a single prompt, including the full content of its latest version and extracted variable names.

Access Control

  • Authenticated users: Can access their own prompts (public or private) OR any other user’s public prompts
  • Anonymous callers: Can only access public prompts (is_public = true)
  • Private prompts: Attempting to access another user’s private prompt returns PROMPT_NOT_FOUND (does not reveal existence to prevent enumeration attacks)

Parameters

prompt_id
string
required
UUID of the prompt to retrieve. Must be a valid UUID format.

Response

Returns a GetPromptResult object with complete prompt details.
id
string
Unique UUID identifier for the prompt
title
string
Prompt title
description
string | null
Optional description of the prompt
content
string
Full content of the prompt’s latest version. This is the template that may contain {{variable}} placeholders.
variables
string[]
Array of variable names extracted from the content using {{variable}} syntax
is_public
boolean
Whether the prompt is publicly accessible
version_number
integer
Version number of the latest prompt version
created_at
string
ISO 8601 timestamp when the prompt was created
updated_at
string
ISO 8601 timestamp when the prompt was last updated

Examples

Request

{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "tools/call",
  "params": {
    "name": "get_prompt",
    "arguments": {
      "prompt_id": "550e8400-e29b-41d4-a716-446655440000"
    }
  }
}

Response

{
  "jsonrpc": "2.0",
  "id": 2,
  "result": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "title": "Code Review Template",
    "description": "Template for reviewing pull requests",
    "content": "Please review the following {{language}} code in {{pr_url}}.\n\nFocus on: {{focus_area}}\n\nProvide feedback on:\n- Code quality\n- Performance\n- Security concerns",
    "variables": ["language", "pr_url", "focus_area"],
    "is_public": true,
    "version_number": 3,
    "created_at": "2024-01-15T10:30:00Z",
    "updated_at": "2024-02-20T14:22:00Z"
  }
}

Implementation Details

  • The tool fetches the prompt and joins with prompt_versions to get the latest version
  • Variables are extracted using the extractVariables() utility which matches {{variable}} patterns
  • The regex supports spaces inside brackets: {{ variable }} is equivalent to {{variable}}
  • Access control is enforced at the application level (service-role client bypasses RLS)
  • Returns the latest version sorted by version_number descending

Error Codes

-32602
INVALID_PARAMS
The prompt_id parameter is missing or not a valid UUID
-32002
PROMPT_NOT_FOUND
Prompt does not exist, is archived, or caller lacks permission to access it
-32603
INTERNAL_ERROR
Database query failed or other internal error occurred

Build docs developers (and LLMs) love