Skip to main content
Glama

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
TOPOS_MCP_FILE_ROOTNoAbsolute path to the repository root. If not set, Topos auto-detects by walking up for .git or pyproject.toml.

Capabilities

Features and capabilities supported by this server

CapabilityDetails
tools
{}
prompts
{}
resources
{}

Tools

Functions exposed to the LLM to take actions

NameDescription
topos_assess_changesetA

Assess a multi-file changeset against a git baseline and roll the per-file verdicts into a project before/after (read-only). Use for a module split or any edit spanning several files. Each file is compared to baseline_ref (new files have no baseline). Flags complexity_relocated_within_file and project_regression. Returns a ChangesetResult.

topos_assess_improvementA

Compare a baseline to a side-by-side proposed variant (read-only). For normal edit-in-place loops, use topos_assess_worktree_change or snapshot first with topos_begin_refactor then topos_assess_snapshot. This tool is for variants supplied as proposed_code or proposed_filepath. Returns an AssessmentResult with status and score/metric deltas.

topos_assess_snapshotA

Assess the current file against a baseline captured by topos_begin_refactor. Loads the stored baseline by snapshot_id and compares it to the current on-disk file, with the same status semantics as topos_assess_improvement. A missing or expired snapshot is reported via blocked_by.

topos_assess_worktree_changeA

Assess an in-place edit against a git revision — the common refactor loop. Stateless: the baseline is read from git (git show <baseline_ref>:<path>, default HEAD) and compared to the current working-tree file. No prior call required. For untracked/new files or an uncommitted pre-edit baseline, use topos_begin_refactor + topos_assess_snapshot.

topos_begin_refactorA

Persist the file's current source as a baseline snapshot before you edit it (writes a snapshot record — its only side effect). Returns a snapshot_id; edit the file in place, then call topos_assess_snapshot(snapshot_id, filepath). Use this when the baseline is not a committed git revision.

topos_calculate_coverageA

Measure how well a test suite exercises its program-under-test, via structural (UAST) coverage (read-only). A standalone signal, separate from the four-pillar quality lattice; for a quality verdict use topos_evaluate_* instead. Computes UAST bipartite declaration matching and k-gram path recall. Returns a CoverageResult.

topos_compare_codeA

Compute the AST (tree-edit) distance between two source-code strings. Read-only and idempotent; parses both snippets in memory, never writes or scores. Use for clone detection or to measure refactor impact; the topos_assess_* tools already fold this in as an anti-gaming check, so call it directly only for the raw number. Returns a ComparisonResult: normalized_distance in [0, 1], similarity (= 1 - it), raw_distance, an operations edit-count map, and source_valid/target_valid (error set if either fails to parse).

topos_compare_filesA

Compute the AST (tree-edit) distance between two source files on disk. Read-only; parses both files, never writes or scores. Use for clone detection or refactor impact; use topos_assess_* for a quality verdict. Returns a ComparisonResult (see topos_compare_code).

topos_depgraph_statusA

Report .gitnexus availability and freshness (read-only). Distinguishes a missing graph from a stale one and from a load/schema failure, so an agent knows whether COMPOSABLE can be trusted and what to do next. Never shells out and never mutates state.

topos_evaluate_codeA

Score a raw code string on the SIMPLE / SECURE / NAVIGABLE quality lattice (read-only; never writes or runs the code). Use for a snippet not yet on disk. SIMPLE, SECURE, and NAVIGABLE are reachable here (CFG/CPG/UAST); COMPOSABLE needs a module dependency graph, so for it use topos_evaluate_file with gitnexus_dir, or topos_evaluate_project for a whole tree. Returns an EvaluationResult: the lattice verdict (SLOP…IDEAL), per-generator scores, and a next-step agent contract.

topos_evaluate_fileA

Score a file on disk on the SIMPLE / COMPOSABLE / SECURE / NAVIGABLE lattice — the only evaluate tool that can reach COMPOSABLE (side-effecting). Unless no_composable is set, this generates/refreshes .gitnexus (given by gitnexus_dir or auto-detected at <root>/.gitnexus) when it's missing or stale, then attaches the resulting ModuleDependencyGraph — the same default behavior as the CLI's topos evaluate. SIMPLE/SECURE/NAVIGABLE always run. When GitNexus isn't installed or generation fails, coupling_available is false and warnings explains why; the rest of the evaluation still succeeds.

topos_evaluate_projectA

Recursively score every supported source file in a directory on the SIMPLE / COMPOSABLE / SECURE / NAVIGABLE lattice, with a project rollup (side-effecting). Autodetects all supported languages (Python, Rust, JavaScript, TypeScript, C++, Go) in one walk — no language argument — and skips unsupported files. The rollup takes the project-wide minimum per dimension (weakest file floors it). Returns page-global named lists (hard_fails, leaf_composable_zeros, maintainability_giants) plus a paginated per-file table (gate failures first); page with limit / offset. Unless no_composable is set, generates/refreshes .gitnexus when missing or stale before scoring, same as topos_evaluate_file and the CLI's topos evaluatecoupling_available/warnings explain it when that isn't possible, without failing the evaluation.

topos_generate_depgraphA

Generate the .gitnexus dependency graph via GitNexus (side-effecting). Ensures the graph by default: no-ops when current, otherwise runs gitnexus analyze. force=true always regenerates.

topos_generate_graphify_graphA

Generate the Graphify knowledge graph (graphify-out/graph.json) via the external graphify CLI (side-effecting). Use before topos_refactor(target="graphify") when no graph exists. Skips regeneration when a graph is already present unless force=true. Wholly independent of .gitnexus/GitNexus — never feeds the scored pillars. For GitNexus dep graphs use topos_generate_depgraph instead.

topos_get_docA

Return a Topos documentation page as Markdown. Use when your MCP client does not expose resource fetching to the agent. Clients that do surface resources should prefer the equivalent resource URI for efficiency: topos://docs/{topic}. Topics: agent-contract (compact loop contract, read first for refactors), lattice (the 16-element H(G_qual) over four generators), metrics (every metric key, thresholds, interpretation), preferences (strict generator rankings and preference walks), priority (priority profiles), workflows (the expanded refactor loop guide).

topos_inspect_codeA

Full metric breakdown for a single code unit (inline string or file). Provide exactly one of code or filepath. Use when you need the per-function detail behind a verdict; use topos_evaluate_* when the medal alone is enough. Returns an InspectionResult: the lattice evaluation, a top-N function complexity table (top_n_functions, default 10), total_functions, and entropy details. With filepath, the verdict is scored on all four generators and agrees with topos_evaluate_file: unless no_composable is set, this generates/refreshes .gitnexus (given by gitnexus_dir or auto-detected at <root>/.gitnexus) when missing or stale, then attaches the ModuleDependencyGraph — so this tool is side-effecting. With inline code there is no module to place in the graph, so only SIMPLE/SECURE/NAVIGABLE are reachable, as in topos_evaluate_code.

topos_preference_walkA

Turn a generator ranking into a preference-ordered relaxation walk. Pure and read-only (lattice math only; no files, no scoring). Call after an evaluation to pick the next verdict to aim for, or to relax the goal gracefully under a token/time budget. Returns a PreferenceWalkResult: walk (steps from target down to just above current), next_step, progress in [0, 1], aspirational_target/fallback_target, and induced_order (all 16 verdicts ranked).

topos_refactorA

Rank structural refactor hotspots for one file (read-only, advisory). Does not score the four pillars — use topos_evaluate_* for medals and topos_assess_* to verify edits afterward. target selects the engine: cycles (CFG loop/branch bodies), dependencies (MDG Forman curvature on imports; needs .gitnexus), process (execution choke points; needs .gitnexus), or graphify (orphan/fragile edges; needs a Graphify graph from topos_generate_graphify_graph). Returns a RefactorResult with ranked hotspots (kind, label, score, suggestion, optional lines).

Prompts

Interactive templates invoked by user choice

NameDescription
topos_refactor_until_idealScaffolds the canonical Topos refactor loop (review → plan → refactor → re-measure) with a concrete target, tool call sequence, and termination criteria.

Resources

Contextual data attached and managed by the client

NameDescription
topos_agent_contractCompact outcome-first contract for agent loops: targets, gates, risks, and next-tool fields.
topos_latticeThe 16-element H(G_qual) over {SIMPLE, COMPOSABLE, SECURE, NAVIGABLE}; bottom = SLOP, top = IDEAL (all four).
topos_metricsEvery metric key, good ranges, and how they roll up into dimension scores.
topos_priorityPriority profiles (simple / composable / secure / navigable) and when to use each.
topos_preferencesUser preferences over G_qual: induced total order on Ω and the targeted relaxation walk toward the ideal intersection.
topos_workflowsThe canonical agent refactor loop: review → plan → refactor → re-measure. Read first.
topos_buildWhich binary is serving you: version + build time, executable path, file root, pid, and whether the binary on disk has been rebuilt since this process started.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Krv-Labs/topos'

If you have feedback or need assistance with the MCP directory API, please join our Discord server