Skip to main content
Glama

Analyze a Solution

analyze_solution

Loads a C#/.NET solution with Roslyn and caches its semantic model in memory, returning a session ID for follow-up 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, the answer carries incompleteRun (projects and 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. If the client cancels, the analysis still finishes: a same-argument retry gets it if no file changed.

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.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "solutionPath": "<solutionPath>"
    },
    "name": "analyze_solution"
  }
}

Input 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.4/5.0
Behavior4/5

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

Discloses traits well beyond the annotations: in-memory session lifetime (90 minutes, 8 sessions), MSBuild side effects writing under obj/, uncommitted edits are read, long runtimes with progress token, and that cancellation still completes so a retry is cheap. It correctly frames itself as not modifying source while readOnlyHint=false is explained by the obj/ generated-file caveat, so no contradiction. Minor gap: it does not say what happens when the 8-session cap is exceeded (eviction policy beyond the number).

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-loads purpose then the optionality rule, and the return-field list and incompleteRun caveat are genuinely load-bearing given there is no output schema. It is long, though, and the parameter paragraph re-explains precedence that the schema already carries, which is the main place words could be cut.

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?

With no output schema, the description enumerates the returned fields including conditional ones (incompleteRun, configInit, agentWiring) and points to solution_config_status and get_diagnostics for follow-up. It also warns that absence of incompleteRun is not an all-clear, which prevents a realistic misread of the result.

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

Parameters3/5

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

Schema coverage is 100% and the schema descriptions already spell out the config precedence chain in detail, so the description largely restates it. It does add one useful operational rule not in the schema — "normally pass only solutionPath" and that layerProfile overrides only the layer axis — but the dbPath/layerProfile precedence material is redundant with the schema, so this sits at the baseline-plus level rather than clearly above it.

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?

Opens with a specific verb, resource and technology (analyze a .sln/.slnx/.slnf with Roslyn) and states its role as the entry point that produces the session_id other tools consume. Siblings like refresh_session and get_diagnostics are explicitly positioned against it.

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-to-use guidance ("Calling it is optional... do not call it just to run a query"), the concrete reasons to call it anyway (read the answer first, pass layerProfile/dbPath), and the correct alternative after editing .cs files (refresh_session). This is about as routing-explicit as it gets.

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