Skip to main content
Glama

smart_search

Search code using natural language descriptions instead of exact keywords. Translates queries, generates search terms, and retrieves symbol definitions from a C/C++ index.

Instructions

USE INSTEAD OF grep, ctx_search, or ctx_compose. Natural-language search: Ollama generates FTS5 keywords, then searches the libclang index. Finds concepts generic tools cannot express with regex.

Read-only. No side effects. Slow (10-30 s) — delegates to the full SMART_SEARCH pipeline (translate → rough_search → llm_query → fts5_search → refine → embedding → rrf_fusion → deduplicate → expand_context → format).

Multi-phase approach:

  1. Translate non-English queries

  2. Rough search to gather sample symbols for naming conventions

  3. Ollama sees those samples + query and generates FTS5 terms

  4. FTS5 search with generated terms

  5. Refine: Ollama checks results and course-corrects query terms

  6. Semantic embedding search (cosine similarity re-rank)

  7. Deduplicate, score, and format results

When to prefer over search_code: When you don't know the exact keywords and want to describe what you're looking for ("how does the modem connect?", "handle BLE pairing failure").

Fallback: When Ollama is unavailable, falls back to direct FTS5 search with word-split terms from the query.

Args: query: Natural language description of what you're looking for. Be specific — 5–15 words works best. project_root: Project root directory. Auto-detected from CWD if omitted. limit: Maximum number of results (default 20, max 100).

Returns: list of dicts with metadata entries (_generated_queries, _rough_queries, _translated_from) followed by symbol results with name, qualified_name, kind, file, line, is_definition, signature, docstring.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum results (default 20, max 100).
queryYesNatural language description, 5-15 words. E.g. 'how does the modem connect?' or 'handle BLE pairing failure'.
project_rootNoProject root. Auto-detected if omitted.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

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

No annotations are provided, so the description carries full burden. It discloses read-only nature, no side effects, slow performance (10-30s), and details the multi-phase pipeline including fallback to direct FTS5 search. This fully compensates for missing annotations.

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?

The description is well-structured with sections and front-loaded purpose. However, it is somewhat lengthy, especially the pipeline details which may not be essential for tool invocation. Still, every sentence earns its place.

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 complexity (multi-phase, fallback, read-only, slow), full schema coverage, and presence of output schema, the description is comprehensive. It explains return format in 'Returns' section and covers all behavioral aspects.

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%, so baseline is 3. The description adds value beyond schema by providing usage tips: 'Be specific — 5–15 words works best' for query, 'Auto-detected from CWD if omitted' for project_root, and 'default 20, max 100' for limit. Examples are also given.

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 this is a natural-language search tool using Ollama and FTS5, distinct from grep and similar sibling tools. It specifies the resource (libclang index) and verb (search), and explicitly distinguishes from siblings like grep, ctx_search, and ctx_compose.

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?

The description explicitly says 'USE INSTEAD OF grep, ctx_search, or ctx_compose.' and provides a 'When to prefer over search_code' section with examples. It also mentions fallback behavior when Ollama is unavailable.

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/turbyho/fw-context-mcp'

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