Skip to main content
Glama

flash-context

CI PyPI version Python versions License

A lightweight, model-agnostic repository search tool for AI agents. Find relevant code, documentation, and configuration through exact lookups or model-guided search, and retrieve compact snippets with validated file-line citations. Available as a Python CLI and Model Context Protocol (MCP) server.

CLI and MCP share a read-only core with path safety and resource limits. Exact lookups can resolve locally; broader queries delegate search and reading to a utility model through an OpenAI-compatible endpoint. Validation checks paths and source ranges; semantic relevance remains the model's judgment. See safety and evidence validation for details and limitations.

Inspired by FastContext, a now-withdrawn paper on separating repository exploration from task solving, using specialized models to return focused file-line evidence while reducing the coding agent's context and token overhead.

Quickstart

Requires Python 3.13+, uv, and an OpenAI-compatible model endpoint with tool calling support.

uv tool install flash-context
export FLASH_CONTEXT_BASE_URL=http://localhost:1234/v1
export FLASH_CONTEXT_MODEL=your-model

flash-context search --repo . --query "Find the request validation logic"

Replace the endpoint and model with your settings. Set FLASH_CONTEXT_API_KEY if authentication is required. Installed commands use environment variables; source checkouts also support project-root config.yaml and .env.

Default output is repository-relative citations:

src/api/validation.py:42-88

Use --no-citation for prose, --format json for results with snippets, or --max-turns N to override the 12-turn default. Exact path and unique symbol lookups can resolve locally without an endpoint. See the CLI contract for options, output schemas, and exit codes.

For example, --query 'httpx/_client.py' returns a bounded file preview, while --query 'BaseTransport' returns its definition if unique within a complete Python source/stub scan. Local successes report turns_used: 0 in JSON.

Use --query 'httpx/_client.py#BaseClient._redirect_method' to resolve a parsed definition locally. A leaf name such as httpx/_client.py#_redirect_method works when unique in that file. Unresolved anchors fall back to model-guided search.

Warnings go to stderr in both output formats. An empty result after scan-budget exhaustion exits 6 while preserving stdout; a complete empty search exits 0. For large repositories, see scan-budget tuning.

Models select symbol or line anchors; the controller resolves bounded syntax regions and returns structural precision metadata. See the shared contract for evidence rules and limits.

Related MCP server: RepoGrammar

MCP

uvx --from 'flash-context[mcp]' flash-context mcp --transport stdio

Exposes search_repository(query, repo_root?, max_turns?, citation?). See MCP integration for editor configuration and source launches.

Documentation

License

Apache License 2.0.

Available Tools

1 tool
explore_repositoryD
NameRequiredDescriptionDefault
queryYes
repo_rootNo
max_turnsNo
citationNo

Output Schema

NameRequiredDescription

No output parameters

TDQS

D1/5.0
Behavior1/5

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

Tool has no description.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness1/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Tool has no description.

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

Completeness1/5

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

Tool has no description.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Tool has no description.

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

Purpose1/5

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

Tool has no description.

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

Usage Guidelines1/5

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

Tool has no description.

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

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 1 tool updatev0.1.0
    • First observedexplore_repository

TDQS

D1.7/5.0

Scored across 1 tool

Disambiguation5/5

Only one tool exists, so there is no possibility of ambiguity between tools.

Naming Consistency5/5

With a single tool, naming consistency is inherently perfect; no pattern deviations exist.

Tool Count2/5

A single tool is far too few for a server presumably focused on repository context, suggesting an underdeveloped or trivial surface.

Completeness1/5

A single generic 'explore' tool without any specialized operations (e.g., get commits, list branches) is severely incomplete for repository exploration.

Maintenance

ActivityMaintained
ResponsivenessResponsive

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    C
    maintenance
    Provides autonomous codebase exploration through a plan-execute-reflect-report pipeline, generating onboarding reports with file:line references. Exposes both a high-level investigation tool and low-level read-only file access tools via MCP.
    MIT
  • A
    license
    A
    quality
    A
    maintenance
    Local, read-only MCP server for coding agents. Indexes repeated implementations in your repository (FastAPI routes, pytest fixtures, Pydantic and SQLAlchemy models) and returns source-backed examples with a bounded read plan, or a typed UNKNOWN when evidence is insufficient. No LLM or network calls.
    1
    3 npm
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables people and AI agents to query local code repositories as graphs through stdio MCP tools for project listing, search, dependency tracing, impact analysis, bridge detection, node inspection, bounded code reading, and optional LSP definition/reference lookups.
    MIT
  • A
    license
    A
    quality
    A
    maintenance
    Local-first code context CLI + MCP server: discover, index, and search repos; generate task-aware context packs, code maps, agent harnesses, and PR-review/merge-readiness gates for coding agents and reviewers.
    14
    718 npm
    3
    MIT