Skip to main content
Glama

Refresh a Session

refresh_session
Idempotent

Re-analyze the session's solution after code edits so callers, change impact, and context queries return current results instead of stale pre-edit graph data.

Instructions

Re-analyze the session's solution after YOUR code edits - call it once you have changed .cs files, otherwise find_usages / impact_of_change / list_insights / get_context may keep answering from the STALE pre-edit graph (a silent source of wrong results). Cheap to call speculatively: a W0 file-set-hash check skips the expensive Roslyn re-run when nothing actually changed, and a C# file whose timestamp moved while its text stayed the snapshot's (a save without an edit) does not count as a change either. That check reads SOURCE files. A restore that rewrote a project's assets file after the load is noticed anyway and reloads through MSBuild; a plain build is not seen - after one, an analysis that reported unresolved references retries once by itself, and 'force' is the deterministic way to demand a reload. Reuses the warm workspace. Returns { changed, reason, session, mode } - the file counts in 'reason' are against the snapshot this session last analyzed, not against a commit or every file you edited: an edit an earlier refresh, an automatic one included, already read is not counted again; 'mode' names the path the re-analysis took ('incremental' = document texts replayed into the warm snapshot without an MSBuild reload, else 'full-reload') and is absent when nothing was re-analyzed. The incremental path can stop engaging without any visible symptom - answers stay correct, calls just get slow again - so 'mode' is how you notice.

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": {
      "sessionId": "<sessionId>"
    },
    "name": "refresh_session"
  }
}

Input Schema

NameRequiredDescriptionDefault
forceNoRe-analyze even when no source file has changed. Use it after a restore/build that was meant to repair unresolved references - those live in build output the file-set hash does not cover, so an ordinary call can legitimately answer 'unchanged'. Costs a full MSBuild reload; leave false for the normal after-an-edit refresh.
sessionIdYesThe session_id returned by analyze_solution. Also takes an absolute .sln/.slnx/.slnf path, analyzed on first use.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.5.46513
    • changedInput schema / properties / sessionId / description
      Previous value: -"The session_id returned by analyze_solution."New value: +"The session_id returned by analyze_solution. Also takes an absolute .sln/.slnx/.slnf path, analyzed on first use."
  2. First observed

TDQS

A4.8/5.0
Behavior5/5

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

Annotations only say non-read-only, idempotent, non-destructive; the description goes far beyond by disclosing the file-set-hash gate, timestamp-vs-text save detection, assets-file restore detection, the blind spot for plain builds, the single automatic retry, and the silent degradation of the incremental path. That is the kind of invisible behavior an agent cannot infer from structured fields.

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?

The action and the staleness warning are front-loaded, and nearly every clause carries operational information. It is, however, one dense paragraph with stacked parentheticals, so an agent has to parse hard to extract the force/mode rules.

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?

There is no output schema, and the description compensates by documenting the return shape ({ changed, reason, session, mode }) and what 'mode' values mean. Combined with the caching and reload behavior, an agent has everything needed to call it and interpret the result.

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 meaning about the interaction between 'force' and the automatic retry ('force is the deterministic way to demand a reload') and about why an ordinary call can return 'unchanged'. It slightly restates the schema's force rationale, which keeps it from 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 ('Re-analyze the session's solution after YOUR code edits') and explicitly separates itself from the read-only analysis siblings (find_usages / impact_of_change / list_insights / get_context) that would otherwise answer from the stale graph. An agent can pick this tool over those without opening any 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 an explicit trigger ('call it once you have changed .cs files'), the cost of skipping it, permission to call speculatively ('cheap to call'), and the escalation path ('force' after a restore/build). It also states the one case where an ordinary call is legitimately a no-op, which is exactly the ambiguity that would otherwise cause misselection.

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