Skip to main content
Glama

Find Calls to External APIs

calls_external
Read-onlyIdempotent

Finds code that calls external .NET APIs (BCL or packages) by substring pattern, such as Process.Start or DateTime.UtcNow, to audit AOT/trimming readiness, security surface, or dependency footprint.

Instructions

Find the code that calls an EXTERNAL member - BCL or package - whose key contains 'pattern'. find_usages answers for solution symbols only; find_by_side_effects classifies the same calls into effect tokens.

Use it for AOT/trimming readiness, security surface or dependency footprint: pass the risky or external API as 'pattern', e.g. 'Process.Start' or 'DateTime.UtcNow'. It is the only search argument; there is no 'symbol'.

Returns scope, pattern, methodsScanned, matches (capped envelope, max 200 hits, sorted by type and name, not ranked) and testMatchesFiltered (units the test filter removed, outside methodsScanned; omitted at 0). A hit carries name, declaringType, namespace, matchedCalls (invoked methods and method groups, keys like 'System.IO.File.ReadAllText(string)') and matchedReads (external properties read or written, like 'System.DateTime.UtcNow'); 'project' or 'projects' name a linked file's twin rows by the builds that declare them ('Name(tfm)'). Units: methods plus every accessor and constructor with a body, under their metadata names (get_X, set_X, .ctor), and, unscoped, each top-level-statement file ('Program.cs (top-level)'); an initializer counts toward the constructor that runs it.

The pattern is a case-insensitive substring of the whole key, parameter list included, so a type name also hits the units that only pass that type to another API. It is an open vocabulary (no did-you-mean); empty is strong, not absolute. Not recorded: an external field read ('string.Empty'), a bare 'new X()', operators and conversions, indexers, event subscriptions and compiler-lowered calls (using, foreach, await). Cross-check a surprising empty against the declaring type ('DateTime', not 'DateTime.UtcNow'). A 'note' leads the answer when it is empty - it says when only the test filter emptied it - and when a project's core references did not resolve: an unresolved call records no key.

Read-only; works on a recalled session. Test-project code is excluded by default (includeTests=true includes it).

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>",
      "pattern": "<pattern>"
    },
    "name": "calls_external"
  }
}

Input Schema

NameRequiredDescriptionDefault
scopeNo'solution' (default) or a namespace prefix (e.g. 'MyApp.Infrastructure') to narrow scope, matched case-insensitively on segment boundaries.solution
patternYesA substring of the external (BCL/third-party) call key to match (case-insensitive), e.g. 'Process.Start', 'File.', 'Assembly.Load', 'System.Reflection', 'JsonSerializer'. Required - a very broad pattern (e.g. 'System') truncates at 200.
sessionIdYesThe session_id returned by analyze_solution. Also takes an absolute .sln/.slnx/.slnf path, analyzed on first use.
includeTestsNoInclude test-project methods (default false - production focus; test setup/assertions calling external APIs would otherwise drown the signal).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.5.46521
    • changedInput schema / properties / scope / description
      Previous value: -"'solution' (default) or a namespace prefix (e.g. 'MyApp.Infrastructure') to narrow scope."New value: +"'solution' (default) or a namespace prefix (e.g. 'MyApp.Infrastructure') to narrow scope, matched case-insensitively on segment boundaries."
  2. 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."
  3. First observed

TDQS

A4.5/5.0
Behavior5/5

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

Annotations already cover safety (readOnly, idempotent, non-destructive, closed world), yet the description still adds substantial behavior: a 200-hit cap, sort order (by type and name, not ranked), the 'note' emitted on empty results, and the test-filter accounting via testMatchesFiltered. Most valuably it enumerates what is NOT recorded (external field reads, bare 'new X()', operators, indexers, event subscriptions, compiler-lowered calls) and warns that unresolved references record no key, which is exactly the kind of false-negative guidance an agent cannot get 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.

Conciseness3/5

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

The purpose and sibling routing are front-loaded, which is right, but the body is a dense wall of jargon-laden clauses (the 'project'/'projects' twin-row explanation and the unit taxonomy) that take real effort to parse. It also restates schema facts such as case-insensitive matching and the includeTests default, so some sentences do not fully earn their place.

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 carries the full burden: it documents the envelope (scope, pattern, methodsScanned, matches), the shape of a hit (name, declaringType, namespace, matchedCalls, matchedReads, project rows), and the unit definition including top-level-statement files. Combined with the cap, sort order, and note semantics, an agent has everything needed to interpret results rather than just call the tool.

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, and the description earns an increment by adding semantics the schema omits: the pattern matches the whole key including the parameter list, it is an open vocabulary with no did-you-mean, an empty result is 'strong, not absolute', and it reiterates there is no 'symbol' argument. Minor repetition of case-insensitivity and the includeTests default is the only shortfall.

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 ("Find the code that calls an EXTERNAL member - BCL or package - whose key contains 'pattern'") and immediately distinguishes itself from two siblings: find_usages covers solution symbols only and find_by_side_effects classifies the same calls into effect tokens. An agent can route between the three 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 Guidelines4/5

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

Gives concrete use cases (AOT/trimming readiness, security surface, dependency footprint) with example patterns like 'Process.Start' and 'DateTime.UtcNow', and explicitly names the alternatives with their differing behavior. What's missing is an explicit when-not-to-use statement or a note on when find_usages/find_by_side_effects should still be preferred for external-looking code, so it lands at clear-context-without-exclusions.

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