Skip to main content
Glama

Query-relevant project context

project_context

Retrieve ranked excerpts across a project's live files for a query, including file path, line range, and heading provenance; returns budget-limited, read-only context.

Instructions

Returns the most RELEVANT excerpts across ALL the project's live files for a query (lexical ranking over structural chunks), each with provenance: file path, 1-based line range, and Typst heading path. Budget-limited and read-only: files with duplicate-path conflicts or over the per-file cap are skipped (listed in skipped with a reason), and selectionTruncated reports when relevant chunks did not fit the budget. Use read_file for a complete file.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "project": "<project>",
      "query": "<query>"
    },
    "name": "project_context"
  }
}

Input Schema

NameRequiredDescriptionDefault
queryYesWhat you are looking for — ranks chunks across the whole project.
budgetNoResponse budget in characters of excerpt text (default 6144).
projectYesThe projectId of the project to work on, as returned by list_projects.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv2026.11.16
    • addedInput schema / properties / project
      Added value: +{
      +  "description": "The projectId of the project to work on, as returned by list_projects.",
      +  "maxLength": 256,
      +  "minLength": 1,
      +  "type": "string"
      +}
    • changedInput schema / required
      Previous value: -[
      -  "query"
      -]New value: +[
      +  "project",
      +  "query"
      +]
  2. Changed1 schema field changedv2026.10.2
    • removedInput schema / additionalProperties
      Removed value: -false
  3. First observedv0.1.0

TDQS

A4.1/5.0
Behavior4/5

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

With no annotations supplied, the description carries the full burden and does so well: it declares the tool read-only, explains the budget cap, states that duplicate-path conflicts and over-cap files are skipped and surfaced in `skipped` with a reason, and that `selectionTruncated` flags budget shortfalls. That is real behavioral disclosure beyond the schema. It stops short of covering permissions/auth or result ordering guarantees.

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?

Three sentences, front-loaded with the core behavior and ending with the sibling routing hint, with no filler. It is dense — several distinct behaviors are packed into the second sentence — but each clause carries information an agent needs.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

There is no output schema, and the description compensates by naming the provenance fields plus the `skipped` and `selectionTruncated` outputs, which is exactly what an agent needs to interpret a partial result. Remaining gaps are minor: no statement of how many excerpts are typical or whether results are returned in rank order.

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 100%, so the schema already documents all three parameters including the default budget of 6144. The description reinforces that `query` ranks across the whole project and that `budget` governs truncation, but adds no syntax, format, or tuning advice beyond what the schema states. Baseline 3 applies when the schema does the heavy lifting.

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 first sentence states a specific verb (returns), a specific resource (relevant excerpts across all live project files), the mechanism (lexical ranking over structural chunks), and the payload (path, 1-based line range, Typst heading path). The final sentence explicitly separates it from read_file, so an agent can choose between the two without opening either schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It names a concrete alternative with a condition: 'Use read_file for a complete file,' which tells the agent this tool is for targeted retrieval rather than full reads. What is missing is the inverse trigger — guidance on when excerpts are preferable (e.g., broad questions, large projects) or any exclusion for very small projects.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.