Skip to main content
Glama
token-context-mcp

token-context-mcp

File skeleton

get_file_skeleton
Read-onlyIdempotent

Extract ordered imports and public/private declaration headers for an indexed file with bodies elided, so agents can grasp file structure within a token budget without reading full source.

Instructions

Extract ordered imports and public/private declaration headers for one indexed file with bodies elided (content=null if stale; omits tail over budget). Use get_symbol_context for bodies.

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": {
      "repo_id": "<repo_id>",
      "path": "<path>"
    },
    "name": "get_file_skeleton"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathYesIndexed repository-relative file path (rejects denied secrets/paths and returns error if unindexed).
profileNoNamed budget profile preset ('locate', 'orient', 'impact', 'read'); defaults to 'read'.
repo_idYesRegistered repository ID from list_repositories (never a filesystem path).
max_tokensNoToken cap for skeleton entries (32 to max_result_tokens; defaults to 'read' profile budget, truncating tail entries).
include_privateNoInclude private/internal symbols (leading underscore or non-exported) when True; defaults to public declarations only.

Output Schema

NameRequiredDescriptionDefault
dataNoFile import count, dependents count, and ordered skeleton declarations.
errorNoPresent when the tool call fails (either a structured {code, message, details} object or a diagnostic string).
budgetNoToken budget accounting for this response.
repo_idNoRegistered repository identifier.
evidenceNoSource-verified file line spans and SHA-256 hashes backing the response.
warningsNoFreshness, ambiguity, redaction, or security warnings.
freshnessNoIndex freshness state ('fresh', 'pending', 'stale', or 'unknown').
truncatedNoTrue if items were omitted due to budget or node limits.
ledger_revNoCurrent evidence ledger revision for repo_id.
completenessNoCoverage/resolution completeness indicator.
index_run_idNoIdentifier of the active index snapshot run.
schema_versionNoEnvelope schema version ('1.0').
untrusted_repository_contentNoTrue when payload embeds raw repository text.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 schema fields changedv0.3.8
    • changedInput schema / properties / include_private / description
      Previous value: -"Include private/internal symbols (leading underscore or non-exported) when True."New value: +"Include private/internal symbols (leading underscore or non-exported) when True; defaults to public declarations only."
    • changedInput schema / properties / max_tokens / description
      Previous value: -"Maximum token budget for the skeleton response (32 to max_result_tokens)."New value: +"Token cap for skeleton entries (32 to max_result_tokens; defaults to 'read' profile budget, truncating tail entries)."
    • changedInput schema / properties / path / description
      Previous value: -"Repository-relative file path to extract imports and declaration headers from."New value: +"Indexed repository-relative file path (rejects denied secrets/paths and returns error if unindexed)."
    • changedInput schema / properties / profile / description
      Previous value: -"Named budget profile ('locate', 'orient', 'impact', 'read'); defaults to 'read'."New value: +"Named budget profile preset ('locate', 'orient', 'impact', 'read'); defaults to 'read'."
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "additionalProperties": true,
      +  "properties": {
      +    "budget": {
      +      "additionalProperties": true,
      +      "description": "Token budget accounting for this response.",
      +      "properties": {
      +        "envelope_reserve": {
      +          "description": "Wire-framing token reserve when budget >= 512.",
      +          "type": "integer"
      +        },
      +        "estimated_tokens": {
      +          "description": "Estimated serialized response tokens.",
      +          "type": "integer"
      +        },
      +        "requested_tokens": {
      +          "description": "Requested or profile-default token budget.",
      +          "type": "integer"
      +        }
      +      },
      +      "type": "object"
      +    },
      +    "completeness": {
      +      "additionalProperties": true,
      +      "description": "Coverage/resolution completeness indicator.",
      +      "properties": {
      +        "basis": {
      +          "description": "How completeness was computed.",
      +          "type": "string"
      +        },
      +        "value": {
      +          "description": "Completeness ratio in [0.0, 1.0], or null if N/A.",
      +          "type": [
      +            "number",
      +            "null"
      +          ]
      +        }
      +      },
      +      "type": "object"
      +    },
      +    "data": {
      +      "additionalProperties": true,
      +      "description": "File import count, dependents count, and ordered skeleton declarations.",
      +      "properties": {
      +        "estimator_version": {
      +          "description": "Token estimator version.",
      +          "type": "string"
      +        },
      +        "imported_by": {
      +          "description": "Number of indexed files importing this module.",
      +          "type": "integer"
      +        },
      +        "imports": {
      +          "description": "Number of imported modules detected in file.",
      +          "type": "integer"
      +        },
      +        "omitted_count": {
      +          "description": "Number of skeleton items omitted due to budget.",
      +          "type": "integer"
      +        },
      +        "path": {
      +          "description": "Canonical repository-relative file path.",
      +          "type": "string"
      +        },
      +        "skeleton": {
      +          "description": "Ordered imports and declaration headers (bodies elided).",
      +          "items": {
      +            "additionalProperties": true,
      +            "properties": {
      +              "body_elided": {
      +                "description": "True when function/method body was elided.",
      +                "type": "boolean"
      +              },
      +              "content": {
      +                "description": "Redacted declaration header, or null if file is stale.",
      +                "type": [
      +                  "string",
      +                  "null"
      +                ]
      +              },
      +              "end_line": {
      +                "description": "1-based end line.",
      +                "type": "integer"
      +              },
      +              "kind": {
      +                "description": "Entry kind ('import', 'function', 'class', 'method', etc.).",
      +                "type": "string"
      +              },
      +              "redacted_lines": {
      +                "description": "Count of secret-redacted lines.",
      +                "type": "integer"
      +              },
      +              "start_line": {
      +                "description": "1-based start line.",
      +                "type": "integer"
      +              },
      +              "symbol_id": {
      +                "description": "Symbol ID for non-import declarations.",
      +                "type": "string"
      +              }
      +            },
      +            "type": "object"
      +          },
      +          "type": "array"
      +        },
      +        "source_sha256": {
      +          "description": "12-character hex prefix of indexed file SHA-256.",
      +          "type": "string"
      +        }
      +      },
      +      "type": "object"
      +    },
      +    "error": {
      +      "additionalProperties": true,
      +      "description": "Present when the tool call fails (either a structured {code, message, details} object or a diagnostic string).",
      +      "properties": {
      +        "code": {
      +          "description": "Machine-readable error code.",
      +          "type": "string"
      +        },
      +        "details": {
      +          "description": "Optional structured metadata for the error.",
      +          "type": "object"
      +        },
      +        "message": {
      +          "description": "Human-readable error explanation.",
      +          "type": "string"
      +        }
      +      },
      +      "type": [
      +        "object",
      +        "string"
      +      ]
      +    },
      +    "evidence": {
      +      "description": "Source-verified file line spans and SHA-256 hashes backing the response.",
      +      "items": {
      +        "additionalProperties": true,
      +        "properties": {
      +          "end_line": {
      +            "description": "1-based end line in source.",
      +            "type": "integer"
      +          },
      +          "path": {
      +            "description": "Repository-relative file path.",
      +            "type": "string"
      +          },
      +          "sha256": {
      +            "description": "12-character hex prefix of indexed file SHA-256.",
      +            "type": "string"
      +          },
      +          "start_line": {
      +            "description": "1-based start line in source.",
      +            "type": "integer"
      +          }
      +        },
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "freshness": {
      +      "description": "Index freshness state ('fresh', 'pending', 'stale', or 'unknown').",
      +      "type": "string"
      +    },
      +    "index_run_id": {
      +      "description": "Identifier of the active index snapshot run.",
      +      "type": [
      +        "string",
      +        "null"
      +      ]
      +    },
      +    "ledger_rev": {
      +      "description": "Current evidence ledger revision for repo_id.",
      +      "type": "integer"
      +    },
      +    "repo_id": {
      +      "description": "Registered repository identifier.",
      +      "type": "string"
      +    },
      +    "schema_version": {
      +      "description": "Envelope schema version ('1.0').",
      +      "type": "string"
      +    },
      +    "truncated": {
      +      "description": "True if items were omitted due to budget or node limits.",
      +      "type": "boolean"
      +    },
      +    "untrusted_repository_content": {
      +      "description": "True when payload embeds raw repository text.",
      +      "type": "boolean"
      +    },
      +    "warnings": {
      +      "description": "Freshness, ambiguity, redaction, or security warnings.",
      +      "items": {
      +        "type": "string"
      +      },
      +      "type": "array"
      +    }
      +  },
      +  "type": "object"
      +}
  2. Changed5 schema fields changedv0.3.7
    • addedInput schema / properties / include_private / description
      Added value: +"Include private/internal symbols (leading underscore or non-exported) when True."
    • addedInput schema / properties / max_tokens / description
      Added value: +"Maximum token budget for the skeleton response (32 to max_result_tokens)."
    • addedInput schema / properties / path / description
      Added value: +"Repository-relative file path to extract imports and declaration headers from."
    • addedInput schema / properties / profile / description
      Added value: +"Named budget profile ('locate', 'orient', 'impact', 'read'); defaults to 'read'."
    • addedInput schema / properties / repo_id / description
      Added value: +"Registered repository ID from list_repositories (never a filesystem path)."
  3. First observedv0.1.0

TDQS

A4.2/5.0
Behavior4/5

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

Beyond the readOnly/idempotent annotations, it discloses two non-obvious behaviors: content=null when the index is stale, and tail entries omitted when over budget. It does not restate error behavior for denied/unindexed paths, but that is already carried by the path parameter schema.

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 sentences, front-loaded with the core operation and followed by a single routing pointer. Every clause (bodies elided, staleness null, budget truncation) carries distinct information with no filler.

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?

For a read-only extraction tool with a full output schema and complete parameter coverage, the description covers return shape, staleness behavior, and truncation semantics. Minor gaps (rate limits, explicit error cases) are already handled by the parameter schema, leaving little missing for correct invocation.

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%, with each parameter documented including profile presets, token bounds, and include_private defaults. The description only echoes the budget/truncation idea ('omits tail over budget') and adds no syntax or interaction detail beyond the schema, 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 (extract) plus exactly what is returned: ordered imports and public/private declaration headers for one indexed file, with bodies elided. This is precise enough to separate it from get_symbol_context 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?

Names the alternative explicitly ('Use get_symbol_context for bodies'), which tells the agent when to route elsewhere. It does not spell out a when-not-to-use case or any prerequisite (e.g. index freshness), so it falls short of full 5-level guidance.

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