Skip to main content
Glama

Analyze a Solution

analyze_solution

Analyzes a C#/.NET solution with Roslyn and caches it in an in-memory session, returning the session ID that other tools use for code queries.

Instructions

Analyze a C#/.NET solution (.sln, .slnx or .slnf) with Roslyn and cache the result as an in-memory session - the entry point of this server: it returns the session_id the other tools take as sessionId.

Calling it is optional: every tool that takes a sessionId also accepts the absolute solution path and analyzes on first use, so do not call it just to run a query. Call it to read this answer first or to pass layerProfile / dbPath. After editing .cs files call refresh_session, not this: a second analyze_solution is a full reload into a new session.

Returns JSON: sessionId, solutionPath, solutionName, projectCount, fileSetHash, layerProfile, lastAccessUtc, origin, lineNumbersAvailable - plus, only when they apply, analyzePreferredTfmOnly, incompleteRun, configInit (config axes still to set up; see solution_config_status) and agentWiring (the agent's guard hooks are missing here).

When a scanned project could not bind even its core framework types (for example a missing targeting pack), the answer carries incompleteRun - how many, which, and the repair - because every later answer of the session inherits that shortfall. Its absence is no all-clear: an unrestored project that still binds its framework is not flagged here; get_diagnostics names its errors.

It changes no source or project file: it opens the solution through MSBuild (whose design-time build can write generated files under obj/), reads the files as they are on disk (uncommitted edits included) and keeps the model in server memory - by default for 90 minutes after the last use, at most 8 sessions. A large solution can take minutes; with a client progress token it reports progress.

Parameters: normally pass only solutionPath; layer profile, namespace exclusions and test profile then come, per axis, from the server's config DB, else the committed .aicb.json beside the solution, else built-in heuristics. layerProfile overrides the layer axis only; dbPath reads all three from another config DB.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dbPathNoOptional absolute path to a config/master DB. When given, the DB's CONFIGURED namespace-exclusion list (per-solution row, else app-global default) is applied during analysis, same as the CLI; where the DB configured none, the committed .aicb.json sidecar's list applies, and only without a sidecar the DB's built-in default (a built-in default is not configuration - solution_config_status names the list in force and its source); the DB's active test-detection profile (per-solution > global > default) is resolved for the session so the test-aware tools (find_dead_code / coverage_gaps / symbol_metrics / find_tests_for / find_by_side_effects / assert_absence / prepare_task / list_insights / get_insight / solution_metrics) honor it; AND - unless an explicit layerProfile is given - the DB's active layer-mapping profile (per-solution > app-global) drives the analysis (dependency-graph layers + LAYER_MAP), matching the insights/metrics/CLI-gate path. All three travel with the session, so downstream tools honor them without re-passing dbPath. Omit to use the server's default config DB (the same one the GUI uses), if the server resolved one - so the GUI's per-solution exclusions + test + layer profile apply automatically; else the DB-free default (the built-in exclusion list, default test heuristic, role-based layers). When a config DB is resolved and a config axis (layer/exclusions/test) is not yet initialized via the guided setup, the response carries a configInit hint pointing to solution_config_status.
layerProfileNoOptional absolute path to a layer-mapping profile JSON. Omit to use the config DB's active layer profile (per-solution > app-global) when a config DB is resolved, else the .aicb.json sidecar's profile, else role-based heuristics.
solutionPathYesAbsolute path to the solution file to analyze (.sln, .slnx or .slnf).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.5.46514
    • changedInput schema / properties / dbPath / description
      Previous value: -"Optional absolute path to a config/master DB. When given, the DB's CONFIGURED namespace-exclusion list (per-solution row, else app-global default) is applied during analysis, same as the CLI; where the DB configured none, the committed .aicb.json sidecar's list applies, and only without a sidecar the DB's built-in default (a built-in default is not configuration - solution_config_status names the list in force and its source); the DB's active test-detection profile (per-solution > global > default) is resolved for the session so the test-aware tools (find_dead_code / coverage_gaps / symbol_metrics / find_tests_for / find_by_side_effects / assert_absence / prepare_task / list_insights / get_insight / solution_metrics) honor it; AND - unless an explicit layerProfile is given - the DB's active layer-mapping profile (per-solution > app-global) drives the analysis (dependency-graph layers + LAYER_MAP), matching the insights/metrics/CLI-gate path. All three travel with the session, so downstream tools honor them without re-passing dbPath. Omit to use the server's default config DB (the same one the GUI uses), if the server resolved one - so the GUI's per-solution exclusions + test + layer profile apply automatically; else the DB-free default (no exclusions, default test heuristic, role-based layers). When a config DB is resolved and a config axis (layer/exclusions/test) is not yet initialized via the guided setup, the response carries a configInit hint pointing to solution_config_status."New value: +"Optional absolute path to a config/master DB. When given, the DB's CONFIGURED namespace-exclusion list (per-solution row, else app-global default) is applied during analysis, same as the CLI; where the DB configured none, the committed .aicb.json sidecar's list applies, and only without a sidecar the DB's built-in default (a built-in default is not configuration - solution_config_status names the list in force and its source); the DB's active test-detection profile (per-solution > global > default) is resolved for the session so the test-aware tools (find_dead_code / coverage_gaps / symbol_metrics / find_tests_for / find_by_side_effects / assert_absence / prepare_task / list_insights / get_insight / solution_metrics) honor it; AND - unless an explicit layerProfile is given - the DB's active layer-mapping profile (per-solution > app-global) drives the analysis (dependency-graph layers + LAYER_MAP), matching the insights/metrics/CLI-gate path. All three travel with the session, so downstream tools honor them without re-passing dbPath. Omit to use the server's default config DB (the same one the GUI uses), if the server resolved one - so the GUI's per-solution exclusions + test + layer profile apply automatically; else the DB-free default (the built-in exclusion list, default test heuristic, role-based layers). When a config DB is resolved and a config axis (layer/exclusions/test) is not yet initialized via the guided setup, the response carries a configInit hint pointing to solution_config_status."
  2. Changed1 schema field changedv0.5.46513
    • changedInput schema / properties / solutionPath / description
      Previous value: -"Absolute path to the .sln file to analyze."New value: +"Absolute path to the solution file to analyze (.sln, .slnx or .slnf)."
  3. First observed

TDQS

A4.8/5.0
Behavior5/5

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

Annotations only supply boolean hints; the description explains the non-read-only hint by disclosing that MSBuild design-time builds can write generated files under obj/, that sources are read as-is on disk, and that the model lives in server memory (90-minute idle TTL, max 8 sessions). It also adds cost/latency context (minutes on large solutions, progress token) and the non-idempotency rationale (a second call is a full reload into a new session), which is exactly the context the hints alone cannot carry.

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?

Front-loaded with purpose, then call-avoidance, return shape, edge-case flag, behavior, and parameters in a sensible order; each paragraph carries distinct information. It is dense and long for a 3-parameter tool, with some clauses (the incompleteRun and configInit passages) that take effort to parse, but little is genuinely redundant with the structured fields.

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?

No output schema exists, so the description correctly enumerates the returned JSON fields, flags which are conditional (analyzePreferredTfmOnly, incompleteRun, configInit, agentWiring) and warns that an absent incompleteRun is not an all-clear, routing the agent to get_diagnostics. For an entry-point tool with three-way config resolution this is complete enough to call correctly.

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?

Schema coverage is 100%, so the baseline is 3, but the description adds real decision guidance beyond the schema: 'normally pass only solutionPath' and the per-axis precedence chain (config DB > committed .aicb.json > built-in heuristics), plus the scoping note that layerProfile overrides only the layer axis. It largely consolidates what the verbose schema descriptions already say, which keeps it short of a 5.

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 and resource ('Analyze a C#/.NET solution (.sln, .slnx or .slnf) with Roslyn') and pins its identity as 'the entry point of this server', explicitly contrasted with refresh_session and with the tools that accept sessionId. An agent can place it among 50+ siblings without opening a schema.

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?

Gives explicit when-not guidance ('Calling it is optional... do not call it just to run a query'), explicit when ('Call it to read this answer first or to pass layerProfile / dbPath'), and names the alternative for the edit case ('After editing .cs files call refresh_session, not this'). Nothing about selection is left to inference.

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