Skip to main content
Glama
f

prompts.chat MCP Server

by f

Search Prompts

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;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the return fields but doesn't cover critical aspects like pagination, rate limits, authentication needs, error handling, or whether results are sorted. This leaves significant gaps for a search tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the purpose and key return information. Every word earns its place with no redundancy or fluff, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a search tool with 5 parameters, no annotations, and no output schema, the description is incomplete. It doesn't address behavioral traits, usage context, or output structure beyond listing return fields, leaving the agent with insufficient guidance for effective tool selection.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents all 5 parameters. The description adds no additional parameter semantics beyond what's in the schema, such as search behavior or filter interactions. Baseline 3 is appropriate when schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Search for') and resource ('AI prompts'), specifying the action and target. It distinguishes from the sibling 'get_prompt' by implying this is a search/filter operation rather than a direct retrieval, though it doesn't explicitly contrast them.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus the sibling 'get_prompt' or other alternatives. It lacks context about prerequisites, exclusions, or specific scenarios where this search is preferred over direct retrieval.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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