Skip to main content
Glama

list_prompts

Browse and filter available prompts from promptz.dev to access development resources without switching contexts, using tags for specific categories.

Instructions

List available prompts from promptz.dev

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cursorNoPagination token for fetching the next set of results
tagsNoFilter prompts by tags (e.g. ['CLI', 'JavaScript'])

Implementation Reference

  • The main handler function for the 'list_prompts' tool. It extracts pagination and filter parameters from the request, calls the searchPrompts helper to query the GraphQL API, formats the results into a JSON structure with prompts list and nextCursor, and returns it as text content.
    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), }, ], }; }
  • Input schema definition for the 'list_prompts' tool, specifying optional 'cursor' for pagination and 'tags' array for filtering.
    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:31-50 (registration)
    Registration of the 'list_prompts' tool in the ListToolsRequest handler, including name, description, and input schema.
    { 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 CallToolRequest handler that maps 'list_prompts' tool calls to the listPromptsToolHandler function.
    case "list_prompts": { return await listPromptsToolHandler(request); }
  • Supporting helper function that executes the GraphQL query to search and list prompts, handling pagination (nextToken) and tags filtering, used directly by the tool handler.
    export async function searchPrompts(nextToken?: string, tags?: string[]): Promise<SearchPromptsResponse> { try { logger.info("[API] Listing prompts" + (tags ? ` with tags: ${tags.join(", ")}` : "")); const { data, error } = await client.query( gql` ${SEARCH_PROMPTS_QUERY} `, { nextToken, tags }, ); if (error) { throw error; } return data; } catch (error) { logger.error(`[Error] Failed to list prompts: ${error instanceof Error ? error.message : String(error)}`); throw new Error(`Failed to list prompts: ${error instanceof Error ? error.message : String(error)}`); } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/cremich/promptz-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server