Stellarion
Tools

stellarion_get_ai_context

Intent-aware code context with token budgeting for AI understanding

The primary tool for understanding code. Given a file and line, it gathers the source code, related symbols, imports, sibling functions, and architecture context -- all shaped by what you intend to do with it.

When to Use

  • Explaining how a function works to a developer
  • Understanding unfamiliar code before modifying it
  • Debugging an issue and needing the full surrounding context
  • Writing tests and needing to see mockable dependencies
  • Any time you need to understand a symbol and its surroundings

Prefer stellarion_get_edit_context instead when you are about to write or modify code, as it adds callers, tests, and git history that this tool omits.

Parameters

ParameterTypeRequiredDefaultDescription
uristringYes--File URI (e.g., file:///path/to/file.ts)
linenumberYes--Line number of the symbol (0-indexed)
intentenumNoexplainOne of: explain, modify, debug, test. Controls which related code is prioritized.
maxTokensnumberNo4000Maximum tokens of context to return. High-priority sections get full source; remaining budget fills with signatures.

Examples

Explain a Function

Natural Language: "What does the processPayment function do?"

MCP Tool Call:

{
  "name": "stellarion_get_ai_context",
  "arguments": {
    "uri": "file:///home/dev/project/src/billing/payment.ts",
    "line": 42,
    "intent": "explain"
  }
}

Returns: Full source of processPayment, signatures of its dependencies (e.g., validateCard, chargeStripe), file imports, sibling functions in the same file, and module architecture info.

Debug an Issue

Natural Language: "There's a bug in the retry logic around line 150 of connection.py"

MCP Tool Call:

{
  "name": "stellarion_get_ai_context",
  "arguments": {
    "uri": "file:///home/dev/project/src/network/connection.py",
    "line": 150,
    "intent": "debug",
    "maxTokens": 6000
  }
}

Returns: Full source, call chain leading to this function, debug hints (complexity score, branches, exception handlers, early returns), and related symbols prioritized for debugging.

Prepare to Write Tests

Natural Language: "I need to write tests for the UserService.authenticate method"

MCP Tool Call:

{
  "name": "stellarion_get_ai_context",
  "arguments": {
    "uri": "file:///home/dev/project/src/services/user_service.ts",
    "line": 88,
    "intent": "test"
  }
}

Returns: Full source of authenticate, existing test examples, mockable dependencies (database client, token generator), and the function's signature with parameter types.

Output Format

The response contains these sections, populated based on intent and token budget:

  • primaryContext -- Full source code of the target function or class
  • relatedSymbols -- Functions this code depends on or that depend on it. Full source when budget allows, signature-only otherwise.
  • imports -- File-level module imports
  • siblingFunctions -- Other functions in the same file (signatures only)
  • dependencies -- Modules this file imports
  • architecture -- Module name, architectural layer, neighboring modules
  • debugHints -- (debug intent only) Complexity score, branch count, exception handlers, early returns

Tips

  • Start with intent: "explain" when you first encounter unfamiliar code. It prioritizes dependencies, callers, and sibling context.
  • Use intent: "modify" before making changes -- it shifts priority toward tests and callers so you know what will be affected.
  • Increase maxTokens for complex functions with many dependencies. Decrease it when you only need a quick overview.
  • The token budget is smart: high-priority sections always get full source code. Lower-priority items gracefully degrade to signature-only to fit the budget.
  • For cross-cutting concerns like "how does auth work?", use stellarion_get_curated_context instead -- it searches the entire codebase rather than starting from a single location.