Skip to main content
Glama

search_content

Search full C/C++ file content for file-scope patterns like extern "C", #define, or type declarations, with FTS5 and ifdef filtering. Returns file-level matches with highlighted snippets.

Instructions

Find patterns in FULL file content — not limited to function bodies.

Searches ifdef-filtered file text — only code that actually compiles for the current build configuration. Inactive #ifdef branches are replaced with blank lines (preserving original line numbers).

Covers file-scope constructs that search_bodies cannot see: extern "C", type declarations in headers, #include, #define, global variables, namespace blocks. Also covers function bodies, but search_bodies is preferred for body-level patterns (per-function context, snippet highlights per match).

When to use search_content vs search_bodies vs search_code:

  • search_content — patterns anywhere in FILES (file scope + bodies): extern "C", InterruptIn, #define, type declarations.

  • search_bodies — patterns in function BODIES only: .attach(, NVIC_SetVector(, callback(&.

  • search_code — find symbols by NAME: interrupt handler, modem init.

project_only=True filters to application paths (src/, lib/). Default False includes vendor SDK files.

Results are file-level (one entry per matching file) — use search_bodies for per-function granularity.

When files_fts is missing (legacy index), falls back to LIKE search on files.content — results include _fallback: "like" and no snippet highlighting. Run fw-context index to upgrade.

Read-only. No side effects. Requires the FTS5 index with file content.

Args: query: FTS5 search terms. 1-3 words. Bare multi-word queries are OR-joined (prefix-wildcarded). Prefer single-word queries. E.g. 'InterruptIn', 'extern C', '#define'. project_root: Project root. Auto-detected if omitted. limit: Maximum results (default 20, max 100). project_only: When True, exclude vendor SDK directories.

Returns: list of dicts, each with: file, language, mtime, _match_snippet (highlighted excerpt around the match).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum results (default 20, max 100).
queryYesFTS5 search terms for full file content. 1-3 words. E.g. 'InterruptIn', 'extern C'. Bare multi-word = OR-joined.
project_onlyNoExclude vendor SDK code (mbed-os/, .pio/, zephyr/, build/). When True, only your application code (src/, lib/). Default False.
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 exist, so description carries full burden. It discloses ifdef-filtering, fallback to LIKE search when FTS5 index missing, read-only nature, and requirement of FTS5 index. Comprehensive and honest.

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 sections and bullet points. Front-loaded core purpose. Slightly long but every sentence adds value; concise for the information density.

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?

Covers all aspects: when to use, behavioral traits, parameter details, fallback, output format (referencing output schema). No gaps given complexity and sibling richness.

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 3. The description adds meaning beyond schema: query parameter explains OR-joined multi-word, limit default/max, project_only lists excluded directories, project_root auto-detection. Valuable added context.

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 specifies it finds patterns in full file content, not limited to function bodies, and contrasts with search_bodies and search_code. The verb 'find' and resource 'file content' are clear, with explicit sibling differentiation.

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?

Includes a dedicated 'When to use' section listing specific use cases for search_content vs search_bodies vs search_code. Also explains project_only filtering and fallback behavior, providing strong guidance.

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