List prompts
listPromptsRetrieve a paginated list of prompt definitions from Langfuse, with filters for name, label, and tag to narrow results.
Instructions
List prompt definitions tracked in Langfuse.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "listPrompts"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| page | No | Page number (default 1) | |
| limit | No | Items per page (default 50, max 100) | |
| name | No | Filter by exact prompt name | |
| label | No | Filter by label (e.g. 'production') | |
| tag | No |
Implementation Reference
- src/tools.ts:153-166 (registration)Registration of the 'listPrompts' tool via server.registerTool() with name, schema, and handler.
server.registerTool( "listPrompts", { title: "List prompts", description: "List prompt definitions tracked in Langfuse.", inputSchema: { ...paginationShape, name: z.string().optional().describe("Filter by exact prompt name"), label: z.string().optional().describe("Filter by label (e.g. 'production')"), tag: z.string().optional(), }, }, async (args) => asJson(await client.get("/api/public/v2/prompts", args)), ); - src/tools.ts:158-164 (schema)Input schema for listPrompts: paginationShape plus optional 'name', 'label', and 'tag' filters.
inputSchema: { ...paginationShape, name: z.string().optional().describe("Filter by exact prompt name"), label: z.string().optional().describe("Filter by label (e.g. 'production')"), tag: z.string().optional(), }, }, - src/tools.ts:165-166 (handler)Handler that calls client.get('/api/public/v2/prompts', args) and formats the JSON response.
async (args) => asJson(await client.get("/api/public/v2/prompts", args)), ); - src/tools.ts:6-8 (helper)The 'asJson' helper that wraps data into the MCP text content format used by all tool handlers.
const asJson = (data: unknown) => ({ content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }], }); - src/tools.ts:392-420 (registration)TOOL_NAMES array that includes 'listPrompts' as one of the exported tool name constants.
export const TOOL_NAMES = [ "listTraces", "getTrace", "listObservations", "getObservation", "listSessions", "getSession", "listScores", "getScore", "listScoreConfigs", "getScoreConfig", "listPrompts", "getPrompt", "listDatasets", "getDataset", "listDatasetItems", "getDatasetItem", "listDatasetRuns", "getDatasetRun", "getMetrics", "getDailyMetrics", "listModels", "getModel", "listProjects", "listComments", "getComment", "getMedia", "getHealth", ] as const;