Skip to main content
Glama

Find Symbols by Attribute

find_by_attribute
Read-onlyIdempotent

Find C# types, methods, properties, and fields by attribute (e.g. Obsolete, Authorize) across a Roslyn solution, including member-level attributes that name-only symbol searches miss.

Instructions

Find symbols (types, methods, properties or fields) that carry a given ATTRIBUTE - a cross-cutting query that find_symbol (name-only) cannot do. The attribute name is matched format-independently: the last name segment, with an optional 'Attribute' suffix stripped, case-insensitive. So 'Obsolete', 'ObsoleteAttribute' and 'System.ObsoleteAttribute' all match the same symbols (types store the fully-qualified attribute class, methods/properties/fields store the source-syntax name - this reconciles both). The raw stored attribute list travels with each hit so you see the ground truth. kinds = 'all' (default - types + methods + properties + fields) / 'type' / 'method' / 'property' / 'field'. Member scanning surfaces a member-level attribute like a CommunityToolkit '[ObservableProperty]' (on a backing field or a modern partial property) or a '[JsonProperty]' that a type/method-only scan misses. Use it for '[Obsolete]', '[ApiController]', '[Authorize]', test attributes, etc. The 'method' axis includes constructors and accessors with a body (named .ctor / get_X / set_X), so a [JsonConstructor] or an [Obsolete] setter is found. A partial type is one type row; 'fullName' marks namesake type rows (Foo, Foo), 'project' the twin rows of a linked file (the build 'Name(tfm)' where only it declares the row; 'projects' where several do), 'declaringTypeFullName' and 'signature' member rows that would read alike (overloads, members of nested or generic namesakes). Deterministic from Roslyn - works on recalled sessions. Capped at 200.

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>",
      "attribute": "<attribute>"
    },
    "name": "find_by_attribute"
  }
}

Input Schema

NameRequiredDescriptionDefault
kindsNoWhich symbol kinds to search: 'all' (default - types + methods + properties + fields), 'type', 'method', 'property', or 'field'.all
scopeNo'solution' (default) or a namespace prefix (e.g. 'MyApp.Api') to narrow scope.solution
attributeYesThe attribute to find (e.g. 'Obsolete', 'ApiController', 'Fact'). Suffix/namespace are normalized away - required.
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.7/5.0
Behavior5/5

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

Annotations already declare a safe read-only, idempotent, closed-world operation, so the description is free to spend its words on real behavior: the 200-result cap, Roslyn determinism, that it works on recalled sessions, that the raw stored attribute list travels with each hit as ground truth, and that a partial type is one row while 'fullName'/'project' disambiguate namesakes and linked-file twins. That is behavior an agent could not infer from the annotations.

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 purpose and the find_symbol contrast are front-loaded, and every clause carries information - nothing is boilerplate. The cost is density: it is effectively one long run-on paragraph where matching rules, kind axes, and output-row disambiguation ('fullName', 'project', 'declaringTypeFullName', 'signature') run together, which makes it harder to scan than a short bulleted structure would.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/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 wisely covers return-side semantics: the raw stored attribute list on each hit, the disambiguation fields on type and member rows, and the 200 cap. Determinism and session recall are also stated. The only visible gap is that behavior on a scope prefix that matches nothing, or on an attribute expressed as a bare fully-qualified name with no short form, is left implicit.

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 baseline is 3, but the description genuinely adds meaning beyond the schema on the key parameter: it spells out that the attribute name is matched format-independently via last name segment plus optional 'Attribute' suffix stripping, case-insensitively, and reconciles the fact that types store a fully-qualified class while members store the source-syntax name. It also restates the kinds values ('all' default includes types + methods + properties + fields). It says nothing extra about scope beyond the schema's namespace-prefix note.

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 symbols ... that carry a given ATTRIBUTE') and immediately scopes it against a named sibling: 'a cross-cutting query that find_symbol (name-only) cannot do.' The parenthetical enumeration of symbol kinds (types, methods, properties, fields) removes any ambiguity about what counts as a symbol.

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?

Explicitly routes the agent away from find_symbol by name-only limitation, gives concrete triggering examples ('[Obsolete]', '[ApiController]', '[Authorize]', test attributes), and explains a case where member scanning is required (CommunityToolkit '[ObservableProperty]' on a backing field, a '[JsonProperty]' a type/method-only scan misses). The 'method' axis including constructors and accessors with a body (.ctor / get_X / set_X) further sharpens when this tool finds things other queries would not.

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