Skip to main content
Glama
reflex-search

Reflex

Official

search_ast

Search codebase for code structure using Tree-sitter AST patterns. Scans all files to match structural elements like functions or classes. Requires glob to limit scope.

Instructions

Structure-aware search using Tree-sitter AST patterns (S-expressions). ⚠️ SLOW: bypasses trigram optimization and scans the ENTIRE codebase (500ms-10s+). In 95% of cases, prefer search_code with symbols: true instead (10-100x faster).

Use this only when you must match code structure rather than text: "all async functions containing a match expression", "every class with a serialize method", etc. You MUST pass glob to limit scope — without it, every file in the codebase is parsed.

Example patterns — Rust: (function_item) @fn; Python: (function_definition) @fn; TypeScript: (class_declaration) @class. Refer to Tree-sitter grammar docs for each language. On "Index not found" / "stale" error, call index_project, then retry.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fileNoFilter by file path (substring)
globNoInclude files matching glob patterns (STRONGLY RECOMMENDED to limit scope, e.g., ['src/**/*.rs'])
langYesLanguage (REQUIRED: rust, typescript, javascript, python, go, java, c, cpp, csharp, php, ruby, kotlin, zig)
forceNoForce execution of potentially expensive queries (bypasses broad query detection)
limitNoMaximum number of results (use with offset for pagination)
pathsNoReturn only unique file paths
offsetNoPagination offset (skip first N results after sorting)
excludeNoExclude files matching glob patterns (e.g., ['target/**', 'node_modules/**'])
patternYesAST pattern (Tree-sitter S-expression, e.g., '(function_item) @fn')
dependenciesNoInclude dependency information (imports) in results. Only extracts static imports.
Behavior5/5

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

With no annotations provided, the description fully discloses performance characteristics: 'SLOW: bypasses trigram optimization and scans the ENTIRE codebase (500ms-10s+).' Also warns about potential 'Index not found' errors and how to retry. This transparency far exceeds minimal requirements.

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?

Well-structured and front-loaded: starts with purpose, then warning, usage guidelines, requirement, examples, and error handling. Every sentence adds value without redundancy.

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?

Despite comprehensive description, it omits details about return format (default output beyond 'paths' option) and result structure, which is notable given no output schema. The complexity (10 parameters) and no output schema demand more completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, providing baseline of 3. The description adds significant value with examples for pattern syntax, emphasis on `glob` importance, and explanation of `force` and `paths` usage. However, not every parameter gains additional insight beyond schema descriptions.

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's function: 'Structure-aware search using Tree-sitter AST patterns (S-expressions).' It distinguishes itself from sibling tools by explicitly recommending `search_code` for most cases and specifying when to use this tool for structural matching.

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?

Excellent guidance: explicitly advises to prefer `search_code` in 95% of cases, states conditions for using this tool ('only when you must match code structure'), and mandates passing `glob` to limit scope. Also provides error recovery instructions.

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