Skip to main content
Glama
kongyo2

Glama MCP Server Search

search_mcp_servers

Read-only

Search the Glama MCP directory for servers using free text queries, retrieve results with pagination, and explore detailed server attributes efficiently.

Instructions

Search for MCP servers in the Glama directory using free text queries

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
afterNoCursor for pagination to get results after this point
firstNoNumber of results to return (1-100, default: 10)
queryNoFree text search query (e.g., 'hacker news', 'database', 'weather')

Implementation Reference

  • The execute handler for the 'search_mcp_servers' tool. It builds query parameters from input args and calls the makeGlamaRequest helper to fetch search results from the Glama MCP API, returning formatted JSON or an error message.
    execute: async (args) => {
      try {
        const params: Record<string, string> = {};
    
        if (args.query) {
          params.query = args.query;
        }
        if (args.first) {
          params.first = args.first.toString();
        }
        if (args.after) {
          params.after = args.after;
        }
    
        const result = await makeGlamaRequest("/v1/servers", params);
    
        return JSON.stringify(result, null, 2);
      } catch (error) {
        return `Error searching MCP servers: ${error instanceof Error ? error.message : String(error)}`;
      }
    },
  • Zod schema defining the input parameters for the 'search_mcp_servers' tool: query (optional free-text search string), first (optional number of results, 1-100, default 10), after (optional pagination cursor).
    parameters: z.object({
      after: z
        .string()
        .optional()
        .describe("Cursor for pagination to get results after this point"),
      first: z
        .number()
        .min(1)
        .max(100)
        .default(10)
        .optional()
        .describe("Number of results to return (1-100, default: 10)"),
      query: z
        .string()
        .optional()
        .describe(
          "Free text search query (e.g., 'hacker news', 'database', 'weather')",
        ),
    }),
  • src/server.ts:38-87 (registration)
    Full registration of the 'search_mcp_servers' tool using server.addTool(), including annotations, description, name, input schema, and execute handler.
    server.addTool({
      annotations: {
        openWorldHint: true, // This tool interacts with external API
        readOnlyHint: true, // This tool only reads data
        title: "Search MCP Servers",
      },
      description:
        "Search for MCP servers in the Glama directory using free text queries",
      execute: async (args) => {
        try {
          const params: Record<string, string> = {};
    
          if (args.query) {
            params.query = args.query;
          }
          if (args.first) {
            params.first = args.first.toString();
          }
          if (args.after) {
            params.after = args.after;
          }
    
          const result = await makeGlamaRequest("/v1/servers", params);
    
          return JSON.stringify(result, null, 2);
        } catch (error) {
          return `Error searching MCP servers: ${error instanceof Error ? error.message : String(error)}`;
        }
      },
      name: "search_mcp_servers",
      parameters: z.object({
        after: z
          .string()
          .optional()
          .describe("Cursor for pagination to get results after this point"),
        first: z
          .number()
          .min(1)
          .max(100)
          .default(10)
          .optional()
          .describe("Number of results to return (1-100, default: 10)"),
        query: z
          .string()
          .optional()
          .describe(
            "Free text search query (e.g., 'hacker news', 'database', 'weather')",
          ),
      }),
    });
  • Helper utility function to construct and make HTTP GET requests to the Glama MCP API endpoints, handling query parameters and error checking. Used by the search_mcp_servers handler.
    async function makeGlamaRequest(
      endpoint: string,
      params?: Record<string, string>,
    ) {
      const url = new URL(`${GLAMA_API_BASE}${endpoint}`);
    
      if (params) {
        Object.entries(params).forEach(([key, value]) => {
          if (value) {
            url.searchParams.append(key, value);
          }
        });
      }
    
      const response = await fetch(url.toString());
    
      if (!response.ok) {
        throw new Error(
          `API request failed: ${response.status} ${response.statusText}`,
        );
      }
    
      return response.json();
    }
Behavior3/5

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

Annotations indicate readOnlyHint=true and openWorldHint=true, covering safety and scope. The description adds context about the search being 'free text' and targeting the 'Glama directory', but doesn't disclose behavioral traits like rate limits, authentication needs, or result format. No contradiction with annotations exists.

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 directly states the tool's purpose without unnecessary words. It's front-loaded and every part contributes to understanding the tool's function.

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

Completeness3/5

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

Given the tool's moderate complexity (search with pagination), annotations cover safety and scope, and schema covers parameters well. However, without an output schema, the description doesn't explain return values or result structure, leaving a gap in completeness for effective agent use.

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 parameters are well-documented in the schema. The description mentions 'free text queries', which aligns with the 'query' parameter but doesn't add significant meaning beyond the schema. Baseline 3 is appropriate as the schema handles most documentation.

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 action ('Search for MCP servers') and resource ('in the Glama directory'), with the specific method 'using free text queries'. However, it doesn't explicitly differentiate from sibling tools like get_mcp_server_attributes or get_mcp_server_details, which likely retrieve specific server details rather than searching a directory.

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 alternatives. It doesn't mention sibling tools, prerequisites, or specific contexts for usage, leaving the agent to infer based on tool names alone.

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

Related 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/kongyo2/Glama-MCP-Server-Search'

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