Skip to main content
Glama

topos_inspect_code

Inspect a code unit (inline or file) to obtain per-function complexity, entropy, and evaluation lattice for detailed analysis behind a verdict.

Instructions

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 three 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 are reachable, as in topos_evaluate_code.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeNo
allowNoOne-off acknowledged dangerous-call patterns for this inspection.
verboseNoInclude raw probe metric floats under each file in the response.
filepathNoPath to the source file inside the project root. Prefer this for large files.
languageNoLanguage for inline `code`; ignored for `filepath`, which is autodetected from the file extension.python
preferencesNoStrict total order on the three generators; see `topos://docs/preferences`.
gitnexus_dirNo.gitnexus directory for COMPOSABLE scoring. When omitted, it is auto-detected at `<file root>/.gitnexus`; if missing or stale, this tool generates/refreshes it first (see `no_composable`). Only used with `filepath` — inline `code` has no module to place in the graph.
no_composableNoSkip GitNexus generation; score whatever `.gitnexus` is already there, or SIMPLE/SECURE only when there is none.
top_n_functionsNoReturn at most this many functions, sorted by descending cyclomatic complexity. Keeps agent context lean on large files.
Behavior5/5

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

Discloses side effects: 'this tool is side-effecting' for filepath, explains .gitnexus generation/refresh. No contradiction with annotations (readOnlyHint=false, etc.). Inline code has no side effects.

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

Conciseness4/5

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

Well-structured with front-loaded purpose and detailed explanation. Slightly lengthy but every sentence adds value. No redundancy.

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

Completeness5/5

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

Complete for complex tool: covers two modes, side effects, return type (InspectionResult with lattice evaluation, top-N functions, etc.), parameter choices. No output schema but description covers return structure.

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

Parameters4/5

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

Adds meaning beyond schema: 'Provide exactly one of code or filepath', explains gitnexus_dir/no_composable for filepath, and top_n_functions default. Schema coverage is high (89%) so baseline is 3, but description adds value.

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?

Explicitly states 'Full metric breakdown for a single code unit (inline string or file)' and differentiates from siblings: 'Use when you need the per-function detail behind a verdict; use topos_evaluate_* when the medal alone is enough.'

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

Usage Guidelines5/5

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

Provides clear when-to-use ('per-function detail behind a verdict') and when-not-to ('when the medal alone is enough'), plus guidance on choosing between 'code' and 'filepath'.

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

Install Server

Other Tools

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