list_prompts
Browse and filter available prompts from promptz.dev to reduce context switching in development workflows.
Instructions
List available prompts from promptz.dev
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": "list_prompts"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cursor | No | Pagination token for fetching the next set of results | |
| tags | No | Filter prompts by tags (e.g. ['CLI', 'JavaScript']) |
Implementation Reference
- src/tools.ts:4-28 (handler)The listPromptsToolHandler function that executes the 'list_prompts' tool: parses arguments, fetches prompts using searchPrompts from GraphQL client, maps results, and returns formatted JSON response.
export async function listPromptsToolHandler(request: CallToolRequest): Promise<CallToolResult> { const nextToken = request.params.arguments?.nextToken as string | undefined; const tags = request.params.arguments?.tags as string[] | undefined; const response = await searchPrompts(nextToken, tags); const prompts = response.searchPrompts.results; const result = { prompts: prompts.map((prompt) => ({ name: prompt.name, description: prompt.description, tags: prompt.tags || [], author: prompt.author, })), nextCursor: response.searchPrompts.nextToken || undefined, }; return { content: [ { type: "text", text: JSON.stringify(result, null, 2), }, ], }; } - src/index.ts:31-50 (schema)Input schema definition for the 'list_prompts' tool in the ListToolsRequestHandler response, specifying cursor and tags parameters.
{ name: "list_prompts", description: "List available prompts from promptz.dev", inputSchema: { type: "object", properties: { cursor: { type: "string", description: "Pagination token for fetching the next set of results", }, tags: { type: "array", items: { type: "string", }, description: "Filter prompts by tags (e.g. ['CLI', 'JavaScript'])", }, }, }, }, - src/index.ts:108-110 (registration)Dispatch registration in the CallToolRequestHandler switch statement, routing 'list_prompts' calls to listPromptsToolHandler.
case "list_prompts": { return await listPromptsToolHandler(request); }