Skip to main content
Glama

find-tools-in-server

Search for tools by name or description in an MCP server using regex patterns. Specify server name, pattern, and search scope for precise results.

Instructions

Find tools matching a pattern in a specific MCP server (returns name and description only)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
caseSensitiveNoWhether the search should be case-sensitive
patternYesRegex pattern to search for in tool names and descriptions
searchInNoWhere to search: in tool names, descriptions, or bothboth
serverNameYesName of the MCP server to search tools in

Implementation Reference

  • The handler function for the "find-tools-in-server" tool. Extracts arguments, invokes serverManager.findToolsInServer, formats the results as JSON text content, or returns an error message.
    async (args, extra) => {
      try {
        const { serverName, pattern, searchIn, caseSensitive } = args;
        const results = await serverManager.findToolsInServer(
          serverName,
          pattern,
          searchIn,
          caseSensitive
        );
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify({ tools: results }, null, 2),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: `Error finding tools in server '${args.serverName}': ${(error as Error).message}`,
            },
          ],
        };
      }
    }
  • Supporting method in McpServerManager that performs the actual tool filtering logic: lists tools from the server client, applies regex filtering based on pattern, searchIn, and caseSensitive options, returns array of matching {name, description}.
    async findToolsInServer(
      serverName: string,
      pattern: string,
      searchIn: "name" | "description" | "both" = "both",
      caseSensitive: boolean = false
    ): Promise<any[]> {
      const client = this.getClient(serverName);
      const toolsResponse = await client.listTools();
    
      if (!toolsResponse.tools || !Array.isArray(toolsResponse.tools)) {
        return [];
      }
    
      const flags = caseSensitive ? "g" : "gi";
      const regex = new RegExp(pattern, flags);
    
      const matchedTools = toolsResponse.tools.filter((tool: any) => {
        const nameMatch = searchIn !== "description" && tool.name && regex.test(tool.name);
        const descriptionMatch = searchIn !== "name" && tool.description && regex.test(tool.description);
        return nameMatch || descriptionMatch;
      });
    
      // Filter to only include name and description
      return matchedTools.map((tool: any) => ({
        name: tool.name,
        description: tool.description,
      }));
    }
  • Zod schema defining the input parameters (serverName, pattern, searchIn, caseSensitive) and their descriptions for the "find-tools-in-server" tool.
    export const FindToolsInServerParamsSchema = z.object({
      serverName: z
        .string()
        .describe("Name of the MCP server to search tools in"),
      pattern: z
        .string()
        .describe("Regex pattern to search for in tool names and descriptions"),
      searchIn: z
        .enum(["name", "description", "both"])
        .default("both")
        .describe("Where to search: in tool names, descriptions, or both"),
      caseSensitive: z
        .boolean()
        .default(false)
        .describe("Whether the search should be case-sensitive"),
    });
  • src/index.ts:245-283 (registration)
    Registers the "find-tools-in-server" tool with the MCP server, providing name, description, Zod-derived parameter schema, and the handler function.
    server.tool(
      "find-tools-in-server",
      "Find tools matching a pattern in a specific MCP server (returns name and description only)",
      {
        serverName: FindToolsInServerParamsSchema.shape.serverName,
        pattern: FindToolsInServerParamsSchema.shape.pattern,
        searchIn: FindToolsInServerParamsSchema.shape.searchIn,
        caseSensitive: FindToolsInServerParamsSchema.shape.caseSensitive,
      },
      async (args, extra) => {
        try {
          const { serverName, pattern, searchIn, caseSensitive } = args;
          const results = await serverManager.findToolsInServer(
            serverName,
            pattern,
            searchIn,
            caseSensitive
          );
    
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify({ tools: results }, null, 2),
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error finding tools in server '${args.serverName}': ${(error as Error).message}`,
              },
            ],
          };
        }
      }
    );
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions the return format ('name and description only') but doesn't disclose other behavioral traits like whether this is a read-only operation, if it requires specific permissions, how it handles no matches, or if there are rate limits. For a search tool with zero annotation coverage, this is insufficient.

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 core purpose ('Find tools matching a pattern') and includes essential qualifiers ('in a specific MCP server', 'returns name and description only'). Every word earns its place with zero waste.

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 4 parameters with full schema coverage and no output schema, the description adequately covers the basic purpose and output scope. However, as a search tool with no annotations, it should ideally mention behavioral aspects like read-only nature or error handling to be more complete for 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 the schema fully documents all 4 parameters. The description adds minimal value beyond the schema by implying 'pattern' is a regex and specifying the output scope, but doesn't provide additional syntax or format details. Baseline 3 is appropriate when the schema does the heavy lifting.

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

Purpose5/5

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

The description clearly states the action ('Find tools matching a pattern'), the resource ('in a specific MCP server'), and the scope ('returns name and description only'). It distinguishes from siblings like 'list-all-tools-in-server' by specifying pattern-based filtering and limited output fields.

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

Usage Guidelines4/5

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

The description implies usage context by specifying 'pattern' matching and 'serverName' requirement, distinguishing it from tools like 'find-tools' (no server specificity) or 'list-all-tools-in-server' (no filtering). However, it doesn't explicitly state when to choose this over alternatives like 'get-tool' for single-tool lookup.

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/warpdev/mcp-hub-mcp'

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