Find Methods by Side Effects
find_by_side_effectsFind C# methods by side-effect profile: filter for io, network, database, logging or other effects, or list pure methods. Use it to answer 'what hits the database?' and locate side-effect-free code.
Instructions
Find code by its side-effect profile: what a method touches in the outside world. Each unit carries effect tokens from a closed set - io, network, database, serialization, logging, cache, messaging, unknown ('unknown' = an external call the analysis could not classify) - or none, which makes it pure. calls_external lists the external calls and property accesses behind a token; an effect that comes from a 'new X()' or is inherited from a callee has no row there.
Use it for 'what hits the database or the network?' and to find pure methods. Effects propagate along calls and creations: calling a method or building an object that writes a file counts as 'io'.
With neither effect nor purity, only impure units are listed. An effect or purity outside its vocabulary, or effect with purity='pure', is rejected with the valid values, never a silent zero.
Returns scope, effect, purity, methodsScanned, matches (capped envelope, max 200 hits: name, declaringType, namespace, effects) and, when they apply, 'note', availableEffects, methodsScannedNote, testMatchesFiltered. The units are methods plus every accessor and constructor with a body, under their metadata names (get_X, set_X, .ctor, .cctor), and, unscoped, each top-level-statement file ('Program.cs (top-level)'); the purity='pure' listing is methods-only. A hit does not split direct from inherited effects.
On zero matches availableEffects lists the tokens present in scope (an empty result reads 'valid token, nothing in scope records it') and the note quotes the token's meaning ('cache' = an external cache API, not an in-memory one), omitted when nothing was scanned. A 'note' leads the answer when a project's core references did not resolve: an unresolved run reports methods as PURE that are not.
Read-only; works on a recalled session. Test projects are excluded unless includeTests=true; testMatchesFiltered counts the removed units, which methodsScanned does not include.
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": "find_by_side_effects"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| scope | No | 'solution' (default) or a namespace prefix (e.g. 'MyApp.Infrastructure') to narrow scope. | solution |
| effect | No | Filter to methods carrying this effect token - exactly one of: io, network, database, serialization, logging, cache, messaging, unknown (case-insensitive; any other value is rejected, not answered with zero). Omit to not filter on a specific effect. | |
| purity | No | 'any' (default), 'pure' (only side-effect-free methods), or 'impure' (only methods with at least one effect). | any |
| sessionId | Yes | The session_id returned by analyze_solution. Also takes an absolute .sln/.slnx/.slnf path, analyzed on first use. | |
| includeTests | No | Include test-project methods (default false - production focus: a 'what hits the DB?' query is otherwise drowned by Seed*/Migrate_*/*RepositoryTests). Set true to also list the methods of test projects. |