Skip to main content
Glama
reflex-search

Reflex

Official

search_ast

Match code structure using AST patterns to find functions, classes, or custom syntactic structures beyond text search.

Instructions

⚠️ ADVANCED USERS ONLY - DO NOT USE UNLESS ABSOLUTELY NECESSARY ⚠️

Structure-aware code search using Tree-sitter AST patterns (S-expressions).

PERFORMANCE WARNING: AST queries bypass trigram optimization and scan the ENTIRE codebase (500ms-10s+).

WHEN TO USE (RARE):

  • You need to match code structure, not just text (e.g., "all async functions with try/catch blocks")

  • --symbols search is insufficient (e.g., need to match specific AST node types)

  • You have a very specific structural pattern that cannot be expressed as text

IN 95% OF CASES, USE search_code with symbols=true INSTEAD (10-100x faster).

REQUIRED: You MUST use glob patterns to limit scope (e.g., glob=['src/**/*.rs']) to avoid scanning thousands of files.

Token efficiency: Previews are auto-truncated to ~100 chars. Use limit parameter to control result count.

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 AST patterns:

  • Rust: '(function_item) @fn' (all functions)

  • Python: '(function_definition) @fn' (all functions)

  • TypeScript: '(class_declaration) @class' (all classes)

Refer to Tree-sitter documentation for each language's grammar.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dependenciesNoInclude dependency information (imports) in results. Only extracts static imports.
excludeNoExclude files matching glob patterns (e.g., ['target/**', 'node_modules/**'])
fileNoFilter by file path (substring)
forceNoForce execution of potentially expensive queries (bypasses broad query detection)
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)
limitNoMaximum number of results (use with offset for pagination)
offsetNoPagination offset (skip first N results after sorting)
pathsNoReturn only unique file paths
patternYesAST pattern (Tree-sitter S-expression, e.g., '(function_item) @fn')
Behavior5/5

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

No annotations exist, so description fully covers behavioral traits: performance warning (500ms-10s+), bypasses trigram optimization, scans entire codebase, preview truncation, and error recovery steps. No contradictions.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Well-structured with clear sections (warning, when to use, required, token efficiency, error handling, examples). Somewhat long but every sentence is informative; no filler. Front-loaded with key guidance.

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

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (10 parameters, advanced usage, no output schema), the description is comprehensive: covers purpose, usage conditions, performance, error recovery, examples, and parameter semantics. Sufficient for correct invocation.

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% with descriptions for each parameter. The description adds critical context: emphasizes glob usage, provides example AST patterns per language, explains the force parameter, and details pagination via limit/offset. Slight redundancy with schema but adds significant value.

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?

Clearly states it performs structure-aware code search using Tree-sitter AST patterns, differentiating it from text-based sibling tools like search_code and search_regex. The purpose is precise and distinct.

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 states it's for advanced users only, provides rare when-to-use scenarios, recommends alternatives (search_code in 95% of cases), and requires glob patterns to limit scope. Also includes error handling instructions for stale indices.

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