Skip to main content
Glama
Search Code MCP

Search Code MCP

by joutvhu

count

Return the number of matching lines or total occurrences for a pattern in files without retrieving match content, saving tokens.

Instructions

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

Input Schema

NameRequiredDescriptionDefault
pathNoDirectory or file to count matches in. Accepts relative or absolute paths (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. Changed1 schema field changedv1.0.2
    • changedInput schema / properties / path / description
      Previous value: -"Directory or file to count matches in (default: '.')"New value: +"Directory or file to count matches in. Accepts relative or absolute paths (default: '.')"
  2. First observedv1.0.0

TDQS

A3.6/5.0
Behavior3/5

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

With no annotations, the description carries full behavioral burden. It usefully discloses one key trait: it returns counts rather than match content, which is a meaningful output-shape cue. It does not mention read-only nature, permission requirements, or gitignore handling (which the noIgnore param implies), leaving notable gaps.

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 tight sentence with the core purpose front-loaded and the token-saving rationale appended. No filler 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?

For a read-oriented counting tool with no output schema and fully covered param schema, the description conveys the essential purpose and output nature. It lacks explicit sibling routing and any note on the perFile breakdown result shape, but is largely sufficient for correct invocation.

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. The description's mention of 'matching lines or total occurrences' mirrors the already-documented countLines parameter without adding syntax, format, or default information beyond it. Baseline 3 applies.

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), and distinguishes itself functionally from content-returning siblings by noting it does not retrieve match content. However, it never names the closest sibling (search) explicitly, so differentiation is implied rather than stated.

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 'without retrieving match content, saving tokens' implies when this tool is preferable to a content-returning search, but there is no explicit when-to-use vs when-not guidance or named alternative (search) among the five siblings. Usage is inferable but not spelled out.

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