Skip to main content
Glama
f

prompts.chat MCP Server

by f

search_prompts

Search AI prompts by keyword, type, category, or tag to find community-curated prompts for AI coding assistants.

Instructions

Search for AI prompts by keyword. Returns matching prompts with title, description, content, author, category, and tags.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query to find relevant prompts
limitNoMaximum number of prompts to return (default 10, max 50)
typeNoFilter by prompt type
categoryNoFilter by category slug
tagNoFilter by tag slug

Implementation Reference

  • Handler function that executes the search_prompts tool by forwarding the request to the prompts.chat upstream API via tools/call.
    async ({ query, limit, type, category, tag }) => { try { const response = await callPromptsChatMcp("tools/call", { name: "search_prompts", arguments: { query, limit, type, category, tag }, }); if (response.error) { return { content: [{ type: "text" as const, text: JSON.stringify({ error: response.error.message }) }], isError: true, }; } const result = response.result as { content: Array<{ type: string; text: string }> }; return { content: [{ type: "text" as const, text: result.content[0].text }], }; } catch (error) { const message = error instanceof Error ? error.message : String(error); return { content: [{ type: "text" as const, text: JSON.stringify({ error: message }) }], isError: true, }; } }
  • Input schema for search_prompts tool defining parameters like query, limit, type, category, and tag using Zod.
    inputSchema: { query: z.string().describe("Search query to find relevant prompts"), limit: z .number() .min(1) .max(50) .default(10) .describe("Maximum number of prompts to return (default 10, max 50)"), type: z .enum(["TEXT", "STRUCTURED", "IMAGE", "VIDEO", "AUDIO"]) .optional() .describe("Filter by prompt type"), category: z.string().optional().describe("Filter by category slug"), tag: z.string().optional().describe("Filter by tag slug"), },
  • src/index.ts:126-174 (registration)
    Registration of the search_prompts tool with server.registerTool, including schema and handler.
    server.registerTool( "search_prompts", { title: "Search Prompts", description: "Search for AI prompts by keyword. Returns matching prompts with title, description, content, author, category, and tags.", inputSchema: { query: z.string().describe("Search query to find relevant prompts"), limit: z .number() .min(1) .max(50) .default(10) .describe("Maximum number of prompts to return (default 10, max 50)"), type: z .enum(["TEXT", "STRUCTURED", "IMAGE", "VIDEO", "AUDIO"]) .optional() .describe("Filter by prompt type"), category: z.string().optional().describe("Filter by category slug"), tag: z.string().optional().describe("Filter by tag slug"), }, }, async ({ query, limit, type, category, tag }) => { try { const response = await callPromptsChatMcp("tools/call", { name: "search_prompts", arguments: { query, limit, type, category, tag }, }); if (response.error) { return { content: [{ type: "text" as const, text: JSON.stringify({ error: response.error.message }) }], isError: true, }; } const result = response.result as { content: Array<{ type: string; text: string }> }; return { content: [{ type: "text" as const, text: result.content[0].text }], }; } catch (error) { const message = error instanceof Error ? error.message : String(error); return { content: [{ type: "text" as const, text: JSON.stringify({ error: message }) }], isError: true, }; } } );
  • Helper function callPromptsChatMcp used by the search_prompts handler to make API calls to prompts.chat.
    async function callPromptsChatMcp( method: string, params?: Record<string, unknown> ): Promise<McpResponse> { const response = await fetch(PROMPTS_CHAT_API, { method: "POST", headers: { "Content-Type": "application/json", Accept: "application/json, text/event-stream", "User-Agent": USER_AGENT, ...(PROMPTS_API_KEY && { "PROMPTS-API-KEY": PROMPTS_API_KEY }), }, body: JSON.stringify({ jsonrpc: "2.0", id: Date.now(), method, params, }), }); if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } const contentType = response.headers.get("content-type") || ""; // Handle SSE response format if (contentType.includes("text/event-stream")) { const text = await response.text(); const lines = text.split("\n"); for (const line of lines) { if (line.startsWith("data: ")) { const jsonStr = line.slice(6); if (jsonStr.trim()) { return JSON.parse(jsonStr) as McpResponse; } } } throw new Error("No valid JSON data found in SSE response"); } return (await response.json()) as McpResponse; }
Install Server

Other Tools

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/f/prompts.chat-mcp'

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