Skip to main content
Glama
etreby
by etreby

context_filter

Filter large local text files by relevance to a query, returning verbatim line-numbered spans to keep context small.

Instructions

Extract only the parts of a large local text file that are relevant to a question.

Use this instead of reading a big build log, test output, diff, or data file into your context. Write the output to a file first, then filter it:

make 2>&1 | tee /tmp/build.log
context_filter("/tmp/build.log", "why did the linker step fail")

Returns spans copied verbatim from the file with exact line numbers, never a summary, so quoted text and line numbers can be cited. It also reports how much was dropped and how close the best dropped chunk scored, so you can tell when to widen the query or raise limit rather than assuming full coverage.

Chunks are embedded on the Intel NPU and ranked by cosine similarity; nothing is written to the semantic index and nothing leaves this machine. This is not a substitute for grep: when you know the exact string to look for, grep is faster, free, and exact. Files under 4 KB and over 256 KB are rejected.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes
limitNo
queryYes
context_linesNo
Behavior5/5

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

With no annotations, the description fully discloses behavior: returns verbatim spans, never summaries, reports dropped coverage, uses Intel NPU embedding, writes nothing to semantic index, and has file size limits (4KB-256KB). It also notes it does not substitute for grep. This is comprehensive transparency without annotation support.

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

Conciseness5/5

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

The description is well-structured: purpose, usage guidance, example, output behavior, technical details, constraints. Each sentence carries useful information; no filler. It is longer than average, but justified by the tool's complexity and the absence of annotations.

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 (NPU-based embedding, filtering, output reporting), the description covers purpose, use cases, alternatives, constraints, privacy, and output format. There is no output schema, but the description clearly explains the returned data: verbatim spans with line numbers and dropped-score statistics. Missing parameter documentation is a minor gap, but the overall context is complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, and the description mentions only the two required parameters (path and query) via example, plus 'limit' implicitly ('raise limit'). The parameter context_lines remains undocumented in both description and schema. The description adds some meaning beyond the schema, but not enough to fully compensate for the 0% coverage gap.

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 'Extract only the parts of a large local text file that are relevant to a question.' This is a specific verb+resource (extract from file) and differentiates itself from grep and other sibling tools. The example invocation further clarifies its exact use.

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 when to use it (instead of reading big logs, test output, diffs) and when not to use it: 'This is not a substitute for grep: when you know the exact string to look for, grep is faster, free, and exact.' It also suggests a workflow with tee and filtering, which provides clear usage context.

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/etreby/intel-npu-tools'

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