search_content
Search full file content for patterns, filtering out inactive #ifdef branches. Ideal for finding extern declarations, macros, includes, and global variables that are only present in compiled code.
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(,callback(&, ISR registration patterns.search_code— find symbols by NAME:interrupt handler,modem init.
project_only=True filters to files with is_project = 1 (project code, excluding vendor/SDK).
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, filter to project code only (files with is_project = 1).
Returns: list of dicts, each with: file, language, mtime, _match_snippet (highlighted excerpt around the match).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum results (default 20, max 100). | |
| query | Yes | FTS5 search terms for full file content. 1-3 words. E.g. 'InterruptIn', 'extern C'. Bare multi-word = OR-joined. | |
| project_only | No | Exclude vendor SDK code. When True, only application code. Default False. | |
| project_root | No | Project root. Auto-detected if omitted. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |