Skip to main content
Glama
papyruslabs-ai

Seshat

Official

Get Optimal Context

get_optimal_context
Read-onlyIdempotent

Build a prioritized reading list of related symbols before editing a function, ranked by importance and fitted to your token budget.

Instructions

Before working on a function, call this to get the most relevant related code ranked by importance and fitted to a token budget. Returns a prioritized reading list of symbols you should understand — better than guessing which files to open. Designed for iterative use: call it on your target, read the top results, then call it again on any surprising dependencies to build a complete picture.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectNoProject name (required in multi-project mode). Use list_projects to see available projects.
strategyNoTraversal strategy: bfs (faster, local neighborhood) or blast_radius (full affected set)
max_tokensNoToken budget for the context window (default: 8000)
target_entityYesEntity ID or name to build context around

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.20.2

TDQS

A4.2/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=true, idempotentHint=true, and openWorldHint=true, covering safety and predictability. The description adds that results are 'ranked by importance' and 'fitted to a token budget,' but does not disclose tie-breaking, edge cases, or rate limits. With annotations doing the heavy lifting on behavior, a 3 is appropriate.

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 action and followed by value proposition and iterative workflow. No filler, though the phrase 'better than guessing' is slightly promotional rather than informative.

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?

For a 4-parameter read-only tool with full schema coverage and no output schema, the description covers purpose, ranking, budgeting, and iterative usage. It gives the agent everything needed to call it correctly without redundancy.

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 parameters like target_entity, strategy, and max_tokens are already documented with descriptions and an enum. The description adds no parameter-specific syntax or default details beyond what the schema provides, so the baseline 3 applies.

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?

States a specific verb ('get') and resource ('optimal context'), and immediately clarifies what that means: 'the most relevant related code ranked by importance and fitted to a token budget.' This distinguishes it from siblings like get_entity or get_dependencies, which return raw results without ranking or budgeting.

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?

Explicitly says when to call it ('Before working on a function') and how to iterate ('read the top results, then call it again on any surprising dependencies'). It fills the gap left by annotations by giving a concrete workflow, which is valuable for a context-building tool.

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