Skip to content

feat(tools): add find_references tool #16

@CalvinAllen

Description

@CalvinAllen

Summary

Add a new MCP tool find_references that finds all usages of a symbol at a given position.

Details

  • Input: file path, line, column, maxResults
  • Uses DTE.Find object for solution-wide search
  • Filters results to reduce false positives
  • Returns ReferencesResult with list of locations

Implementation Tasks

  • Add FindReferencesAsync(string path, int line, int column, int maxResults) to IVisualStudioRpc in RpcContracts.cs
  • Add FindReferencesAsync to IVisualStudioService.cs
  • Implement FindReferencesAsync in VisualStudioService.cs
  • Get symbol name at specified position
  • Configure DTE.Find for solution-wide search
  • Execute search and collect results
  • Add filtering logic to reduce false positives
  • Implement maxResults limiting with Truncated flag
  • Add forwarding method in RpcServer.cs
  • Add proxy method in RpcClient.cs
  • Add find_references tool method to NavigationTools.cs
  • Build and verify no errors

Limitations

  • Text-based search may have false positives in comments/strings
  • Performance may be slow on large solutions (mitigated with maxResults)

Dependencies

Notes

This is Phase 4 of the LSP-style navigation tools feature. Most complex tool, benefits from patterns established in earlier phases.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions