Skip to main content
Glama
reflex-search

Reflex

Official

count_occurrences

Count occurrences of a text pattern across your codebase. Get total matches and file count quickly without loading files, with support for language, file, and glob filters.

Instructions

Quick statistics - count how many times a pattern occurs.

Purpose: Get total occurrence count and file count without loading any content.

Use this when:

  • You need quick stats ("how many times is X used?")

  • Checking impact before refactoring

  • Validating search scope

Returns: {total: count, files: count, pattern: string}

Supports: All filters (lang, file, glob, exclude, symbols)

Error Handling: If you receive an error message containing "Index not found" or "stale", immediately call the index_project tool, wait for it to complete, then retry this operation.

Example output: {"total": 87, "files": 12, "pattern": "CourtCase"}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dependenciesNoInclude dependency information (imports) in results. Only extracts static imports.
excludeNoExclude files matching patterns
fileNoFilter by file path substring
forceNoForce execution of potentially expensive queries (bypasses broad query detection)
globNoInclude files matching patterns
kindNoFilter by symbol kind (function, class, etc.)
langNoFilter by language
patternYesSearch pattern (text to find)
symbolsNoCount symbol definitions only (not usages)
Behavior4/5

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

No annotations provided, so the description carries the full burden. It discloses that the tool does not load content, returns specific JSON structure, and includes error handling instructions. However, it could be more explicit about performance or limitations.

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 well-structured with clear sections (Purpose, Use when, Returns, Supports, Error handling, Example). It is front-loaded and each sentence adds value without unnecessary fluff.

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 complexity (9 parameters, no output schema), the description provides output format, error recovery, example, and usage guidance. It is mostly complete, though adding case-sensitivity or pattern syntax details would improve it.

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%, and the description adds a list of supported filters. No additional meaning is provided beyond what the schema already offers. Baseline score of 3 is appropriate.

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 tool counts occurrences of a pattern and provides total count and file count without loading content. It distinguishes from sibling tools like search_code by emphasizing quick statistics.

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

Usage Guidelines5/5

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

Explicitly lists use cases ('Use this when:') with three bullet points: quick stats, impact checking before refactoring, and validating search scope. Implicitly tells when not to use (when full content or detail is needed).

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/reflex-search/reflex'

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