Skip to main content
Glama
Vaishnavi-Raykar

Ressl AI MCP Server

exact_word_search

Find exact word matches in files to locate specific terms without partial matches, using case sensitivity options for precise text searches.

Instructions

Search for an exact word match within a specified file. Only matches complete words, not partial matches.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filePathYesPath to the file to search in
wordYesExact word to search for in the file
caseSensitiveNoWhether the search should be case sensitive

Implementation Reference

  • Core handler function executing the exact word search using regex for word boundaries, supporting case-sensitive option, reading file, finding matches, and returning SearchResult.
    export async function exactWordSearch(
      filePath: string,
      word: string,
      caseSensitive: boolean = false
    ): Promise<SearchResult> {
      try {
        const absolutePath = path.resolve(filePath);
        const fileContent = await fs.readFile(absolutePath, "utf-8");
        const lines = fileContent.split("\n");
        const matches: Match[] = [];
    
        const wordBoundaryPattern = caseSensitive
          ? new RegExp(`\\b${escapeRegex(word)}\\b`, "g")
          : new RegExp(`\\b${escapeRegex(word)}\\b`, "gi");
    
        lines.forEach((line, index) => {
          let match;
          const regex = new RegExp(wordBoundaryPattern);
          
          while ((match = regex.exec(line)) !== null) {
            matches.push({
              lineNumber: index + 1,
              lineContent: line.trim(),
              columnPosition: match.index + 1,
              matchedText: match[0],
            });
          }
        });
    
        return {
          success: true,
          filePath: absolutePath,
          keyword: word,
          matches,
          totalMatches: matches.length,
          searchType: caseSensitive ? "exact word (case sensitive)" : "exact word (case insensitive)",
        };
      } catch (error) {
        return {
          success: false,
          filePath,
          keyword: word,
          matches: [],
          totalMatches: 0,
          searchType: "exact word",
          error: error instanceof Error ? error.message : "Unknown error occurred",
        };
      }
    }
  • Input schema defining parameters for the exact_word_search tool: filePath (string, required), word (string, required), caseSensitive (boolean, optional, default false).
    inputSchema: {
      type: "object",
      properties: {
        filePath: {
          type: "string",
          description: "Path to the file to search in",
        },
        word: {
          type: "string",
          description: "Exact word to search for in the file",
        },
        caseSensitive: {
          type: "boolean",
          description: "Whether the search should be case sensitive",
          default: false,
        },
      },
      required: ["filePath", "word"],
    },
  • src/index.ts:42-64 (registration)
    Registration of the exact_word_search tool in the ListTools response, including name, description, and input schema.
    {
      name: "exact_word_search",
      description: "Search for an exact word match within a specified file. Only matches complete words, not partial matches.",
      inputSchema: {
        type: "object",
        properties: {
          filePath: {
            type: "string",
            description: "Path to the file to search in",
          },
          word: {
            type: "string",
            description: "Exact word to search for in the file",
          },
          caseSensitive: {
            type: "boolean",
            description: "Whether the search should be case sensitive",
            default: false,
          },
        },
        required: ["filePath", "word"],
      },
    },
  • Type definitions for SearchResult (output) and Match interfaces used by the handler.
    interface SearchResult {
      success: boolean;
      filePath: string;
      keyword: string;
      matches: Match[];
      totalMatches: number;
      searchType: string;
      error?: string;
    }
  • Utility function to escape special regex characters in the search word.
    function escapeRegex(text: string): string {
      return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
    }
Behavior3/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 clearly describes the matching behavior ('exact word match', 'complete words, not partial matches'), which is valuable. However, it doesn't mention error handling, performance characteristics, or what happens if the file doesn't exist, leaving some behavioral aspects unspecified.

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 perfectly concise with two sentences that each earn their place. The first sentence states the core functionality, and the second sentence provides crucial behavioral clarification about exact vs. partial matching. No wasted words or redundancy.

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

Completeness4/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 operation with 3 parameters), no annotations, and no output schema, the description does well by clearly explaining the exact matching behavior. However, it doesn't describe the return format or what happens on no matches, which would be helpful for a search tool without output schema documentation.

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?

The schema description coverage is 100%, so the schema already documents all three parameters thoroughly. The description doesn't add any parameter-specific information beyond what's in the schema descriptions, but it does reinforce the 'exact word' concept for the 'word' parameter. This meets the baseline of 3 when schema coverage is high.

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 specific action ('Search for an exact word match') and resource ('within a specified file'), with explicit differentiation from partial matching. It distinguishes from the sibling tool 'search_in_file' by emphasizing exact word matching, providing clear purpose distinction.

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 provides clear context about when to use this tool ('Only matches complete words, not partial matches'), which implicitly suggests alternatives for partial matching. However, it doesn't explicitly name the sibling tool 'search_in_file' or provide explicit when-not-to-use guidance, keeping it at a 4 rather than a perfect 5.

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/Vaishnavi-Raykar/mcp-server'

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