Skip to main content
Glama

get_section_context

Read-only

Retrieve a documentation section with ancestor headings, target content, and child summaries to preserve hierarchy context without reading the whole file.

Instructions

Retrieve a section with its full hierarchy context: ancestor headings (root → parent) for orientation, the target section's content, and immediate child summaries. Prevents 'section too thin' without falling back to whole-file reads.

Input Schema

NameRequiredDescriptionDefault
repoYesRepository identifier (owner/repo or just repo name)
max_tokensNoApproximate token budget for the target section's content (bytes/4 estimate). Ancestors and child summaries are always included.
section_idYesTarget section ID from get_toc, search_sections, etc. v1.147+ — also accepts a `doc.md#anchor` reference to a heading written with an explicit `{#id}`; an ambiguous reference sets `anchor_ambiguous`, `anchor_scope`, `anchor_match_count`, `anchor_candidates` (at most 20), `anchor_candidates_truncated` and `warning`.
include_relatedNov1.20+ adaptive context: append structural + semantic neighbor summaries.
include_childrenNoInclude immediate child section summaries (no content reads). Default true.
strip_boilerplateNov1.24+ — strip repeated cross-section fragments before returning the target section content.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv1.147.0
    • changedInput schema / properties / section_id / description
      Previous value: -"Target section ID from get_toc, search_sections, etc."New value: +"Target section ID from get_toc, search_sections, etc. v1.147+ — also accepts a `doc.md#anchor` reference to a heading written with an explicit `{#id}`; an ambiguous reference sets `anchor_ambiguous`, `anchor_scope`, `anchor_match_count`, `anchor_candidates` (at most 20), `anchor_candidates_truncated` and `warning`."
  2. Addedv1.118.0
  3. Removedv1.99.0
  4. First observedv1.66.3

TDQS

A3.8/5.0
Behavior4/5

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

readOnlyHint=true already establishes a safe read, so the bar is lower. The description adds useful behavioral context by disclosing exactly what the response is composed of (ancestor chain root→parent, target content, immediate child summaries) and the motivation for the composite. It omits any mention of token-budget behavior or the ambiguity-handling signal, which the schema covers.

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?

Two tightly packed sentences, front-loaded with the return composition and finishing with the motivating rationale. No filler; every clause carries information.

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, so the description rightly explains the return structure (ancestors, target content, child summaries). For a six-parameter read tool with rich schema documentation and a readOnly annotation, this is largely complete, with only minor gaps around token-budget and ambiguity behavior that the schema already handles.

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 description coverage is 100%, so the schema fully documents all six parameters (max_tokens budget, include_related, include_children, strip_boilerplate, etc.). The description adds conceptual framing (child summaries, ancestor orientation) but no parameter syntax or default meaning beyond what the schema already states, matching the baseline 3.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb (retrieve) and resource (a section) plus the distinctive composite payload: ancestor headings, target content, and child summaries. This clearly differentiates it from plain get_section or get_section_summary by describing what extra context is bundled, though it does not name a sibling explicitly.

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

Usage Guidelines3/5

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

The phrase "Prevents 'section too thin' without falling back to whole-file reads" implies when to prefer this over a whole-file read (get_doc), which counts as implied usage guidance. However, it gives no explicit when-to-use/when-not framing or names the section-level alternatives (get_section, get_section_descendants) an agent should weigh against it.

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