Skip to content

Find Unused Symbols

find-unused-symbols · Query · CorePlugin · Code analysis

Uses only compiler diagnostics CS0168, CS0169 and CS0219 to identify candidate unused symbols. Use this to review potentially removable locals and private members; inspect find-references before removing code, or get-diagnostics for the underlying warnings. includeInternal widens the accessibility filter; generated-looking documents are excluded by default. Searches the selected scope, or the loaded solution when scope is omitted. Returns up to 50 candidates by default; check candidates.hasMore before treating the candidate list as complete.

Availability: Built in and published in every operational mode.

Generated from Roslyn Workbench MCP 1.2.0 (1.2.0).

Behaviour annotations

Annotation Value
destructiveHint false
idempotentHint true
openWorldHint false
readOnlyHint true
title "Find Unused Symbols"

Request

Property Type Required Description
scope object | null No The optional search scope.
includeInternal boolean No Whether internal members should be included.
excludeGenerated boolean No Whether generated files should be excluded.
candidatesLimit integer | null No Maximum number of results to return.
workspace object | null No Provide workspaceId, alias, path, or any combination.

Response

Success response

Property Type Required Description
ok boolean constant (true) Yes Whether the tool invocation succeeded.
data object | null Yes Tool-specific result payload.
snapshot object Yes Exact immutable workspace snapshot associated with the result, when available.
warnings array No Non-fatal warnings the agent should consider.

Error response

Property Type Required Description
ok boolean constant (false) Yes Whether the tool invocation succeeded.
error object Yes Structured error details when the invocation failed.
continuation oneOf No Action the agent should take before retrying or continuing.
diagnostics array No Diagnostics that explain the failed invocation.
warnings array No Non-fatal warnings the agent should consider.

Error response

Property Type Required Description
ok boolean constant (false) Yes Whether the tool invocation succeeded.
error object Yes Structured error details when the invocation failed.
diagnostics object Yes Diagnostics that explain the failed invocation.
reporting object No Error-reporting workflow available for an unhandled failure.

Bounded collections and continuation

These response locations publish returned items with explicit bounds and continuation state:

  • $/oneOf/0/properties/data/properties/candidates

Continuations and required actions

A response may include a structured continuation at the following schema location. Follow its tool call or user-action instruction instead of guessing how to continue:

  • $/oneOf/1/properties/continuation
Complete input schema
{
  "type": "object",
  "properties": {
    "scope": {
      "description": "The optional search scope.",
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "Solution",
            "Project",
            "Document",
            "Projects"
          ],
          "default": "Solution"
        },
        "project": {
          "$ref": "#/$defs/project",
          "description": "Used only when kind is Project."
        },
        "document": {
          "description": "Used only when kind is Document.",
          "type": [
            "object",
            "null"
          ],
          "properties": {
            "project": {
              "$ref": "#/$defs/project",
              "description": "Disambiguates documents with matching paths or IDs."
            },
            "path": {
              "description": "Workspace-relative path.",
              "type": "string"
            },
            "documentId": {
              "description": "Workspace-local document ID.",
              "type": "string"
            }
          }
        },
        "projects": {
          "description": "Used only when kind is Projects.",
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/$defs/project",
            "description": "Provide projectId, name, path, targetFramework, or any combination."
          }
        }
      }
    },
    "includeInternal": {
      "description": "Whether internal members should be included.",
      "type": "boolean"
    },
    "excludeGenerated": {
      "description": "Whether generated files should be excluded.",
      "type": "boolean"
    },
    "candidatesLimit": {
      "description": "Maximum number of results to return.",
      "type": [
        "integer",
        "null"
      ],
      "minimum": 0,
      "maximum": 2147483647,
      "default": 50
    },
    "workspace": {
      "description": "Provide workspaceId, alias, path, or any combination.",
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "workspaceId": {
          "type": "string",
          "format": "uuid"
        },
        "alias": {
          "type": "string"
        },
        "path": {
          "description": "Absolute workspace path.",
          "type"