search_code_semantic
[SUPPORT] 93fce816 — Cursor-style LOCAL semantic code search over a source tree, entirely in a DuckDB sidecar (no cloud round-trip). Parses Python (stdlib ast) and TypeScript/JavaScript (tree-sitter) into SEMANTIC CHUNKS at function/class/method boundaries PLUS the un-named logical blocks that a ...
This record as markdown: /tools/io-github-ajc3xc-meridian/search-code-semantic.md
What search_code_semantic does on Meridian
AI agents call search_code_semantic to retrieve information from Meridian without modifying anything. It is typically the context-gathering step in research, monitoring, and reporting workflows, before the agent takes action elsewhere.
| Parameter | Type | Required | Description |
|---|---|---|---|
kind | string | — | Optional chunk-kind filter: one of 'function', 'class', 'method', 'interface', 'enum', 'module'. |
limit | integer | — | Max ranked hits to return (default 10). |
query | string | Yes | The search query — keywords and/or a natural-language description of the code you want to find. |
reindex | boolean | — | Default true — run an incremental Merkle-diff reindex before searching so results reflect the current tree. Set false to search the last-built index as-is. |
root_dir | string | Yes | Absolute path to the source-tree root to index and search (walked recursively; vendored/build dirs like node_modules/.git/dist are pruned). |
Parameters from the server's own tool schema.
Why search_code_semantic is rated Low
This tool retrieves and queries code semantically from a local source tree. It is purely informational—searching for patterns or terms in code without side effects. The description emphasizes read-only operations (parsing, searching, finding) with incremental optimization via merkle trees for efficiency. No write, execute, destructive, or financial operations are indicated.
From the tool's definition Performs semantic code search over a source tree with DuckDB sidecar; described as retrieval operation ('search') with no modification or deletion capabilities. The tool 'parses' and queries code semantically but does not create, update, or delete data.
Risk signalsAdmin/system-level operation
Attacks that exploit this kind of access
The rule that runs search_code_semantic safely
PolicyLayer is an MCP gateway: it sits between your AI agents and Meridian, and checks every tool call against a rule you set before the call runs. Nothing changes on the server itself. For search_code_semantic, this is the rule to start with:
search_code_semantic is read-only, so it stays allowed. Everything else on the server is denied unless you say otherwise.
The button opens the PolicyLayer dashboard: create your workspace, connect Meridian, apply this rule, and every search_code_semantic call is checked against it from then on.
Questions about search_code_semantic
[SUPPORT] 93fce816 — Cursor-style LOCAL semantic code search over a source tree, entirely in a DuckDB sidecar (no cloud round-trip). Parses Python (stdlib ast) and TypeScript/JavaScript (tree-sitter) into SEMANTIC CHUNKS at function/class/method boundaries PLUS the un-named logical blocks that a named-symbols-only graph search can't reach (module-level dict/list literals, bare calls, __main__ guards, imports) — so a term that only appears in a bare top-level call is still findable. Incremental by a content MERKLE TREE: the root hash is compared first and only divergent subtrees are walked, so only the files that actually changed since the last pass are re-chunked (repeat calls on an unchanged tree are near-free). Search is HYBRID — DuckDB native FTS (Okapi BM25) for keyword match, fused via Reciprocal Rank Fusion with an OPTIONAL local-embedding vector leg (DuckDB VSS / HNSW cosine over a Model2Vec static model) when MERIDIAN_CODE_INDEX_VECTORS is enabled; with vectors off (the default) it is a complete pure-BM25 code search. Returns {root_dir, query, total_indexed, vectors_enabled, vectors_active, hits:[{chunk_id, path, language, kind, name, line_start, line_end, content, score, bm25, bm25_rank, vector_rank}]}. A missing dir / empty tree returns an empty hits list, never an error. It is categorised as a Read tool in the Meridian MCP Server, which means it retrieves data without modifying state.
search_code_semantic accepts 5 parameters: kind, limit, query, reindex, root_dir. Required: query, root_dir. The full parameter table on this page comes from the server's own tool schema.
Register the Meridian MCP server in PolicyLayer and add a rule for search_code_semantic: allow, deny, rate-limit, or require approval. Point your MCP client at the PolicyLayer proxy URL and the rule is enforced on every call, before it reaches Meridian. Nothing to install.
search_code_semantic is a Read tool with low risk. Read-only tools are generally safe to allow by default.
Yes. Add a rate_limit block to the search_code_semantic rule in your PolicyLayer policy. For example, setting max: 10 and window: 60 limits the tool to 10 calls per minute. Rate limits are tracked per agent session and reset automatically.
Set action: deny in the PolicyLayer policy for search_code_semantic. The AI agent will receive a policy violation error and cannot call the tool. You can also include a reason field to explain why the tool is blocked.
search_code_semantic is provided by the Meridian MCP server (@meridianmcp/mcp). PolicyLayer sits as a proxy in front of this server to enforce policies before tool calls reach the server.
More on Meridian, and thousands of servers like it.
This server
Across the catalogue