Skip to main content
Glama
joutvhu

Search Code MCP

by joutvhu

count

Tally matching lines or total occurrences of a pattern in files, optionally per file, without returning match content to save tokens.

Instructions

Count matching lines or total occurrences of a pattern in files without retrieving match content, saving tokens.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathNoDirectory or file to count matches in (default: '.').
typeNoEngine mode: 'regex' (default), 'text', 'ast'regex
queryYesSearch pattern to count
perFileNoIf true, shows breakdown of matches per file
fileTypeNoFile type filter
languageNoLanguage for AST mode
noIgnoreNoWhether to count inside gitignored files
countLinesNoCount matching lines (true) or total occurrences (false)
filePatternNoGlob pattern to filter files
excludePatternNoGlob pattern to exclude

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A3.5/5.0
Behavior3/5

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

With no annotations, the description carries the full behavioral burden. It usefully discloses the key trait that no match content is returned (only counts), which is the main risk of confusing it with a retrieval tool. However, it does not state that the operation is read-only, that nothing is mutated, or that perFile=true changes the return shape.

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?

A single sentence with the core action front-loaded and zero filler. Both clauses (what it counts, and the token-saving consequence) earn their place.

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?

For a ten-parameter tool with no annotations and no output schema, the description covers the core purpose but not the return-value shape. It never mentions that perFile=true produces a per-file breakdown or that results otherwise default to aggregate counts (countLines=true), which an agent needs to interpret output.

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 all ten parameters are already documented in the schema, which sets the baseline at 3. The description's 'matching lines or total occurrences' loosely mirrors the countLines parameter but adds no syntax, format, or default detail beyond the schema.

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?

States a specific verb (count) and resource (matching lines or total occurrences of a pattern in files) with a clear scope. It implicitly distinguishes itself from the sibling 'search' by noting it counts 'without retrieving match content', so an agent can tell the two apart without opening the schema.

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

Usage Guidelines3/5

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

The phrase 'saving tokens' hints at the condition for choosing this tool over content-returning siblings like 'search', but it never explicitly says 'use this when you only need counts'. Usage is implied rather than stated, and no exclusions or alternatives are named.

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

Deploy Server

Other Tools