Skip to content

feat(tools): add goto_definition navigation tool #15

@CalvinAllen

Description

@CalvinAllen

Summary

Add a new MCP tool goto_definition that finds where a symbol at a given position is defined.

Details

  • Input: file path, line, column
  • Uses DTE.ExecuteCommand("Edit.GoToDefinition") after positioning cursor
  • Captures resulting document/position as definition location
  • Returns DefinitionResult with location(s) and symbol info

Implementation Tasks

  • Add GoToDefinitionAsync(string path, int line, int column) to IVisualStudioRpc in RpcContracts.cs
  • Add GoToDefinitionAsync to IVisualStudioService.cs
  • Implement GoToDefinitionAsync in VisualStudioService.cs
  • Handle document opening and cursor positioning
  • Execute Edit.GoToDefinition command
  • Capture resulting location
  • Handle edge cases (no definition found, external code)
  • Add forwarding method in RpcServer.cs
  • Add proxy method in RpcClient.cs
  • Add goto_definition tool method to NavigationTools.cs
  • Build and verify no errors

Limitations

  • Cannot navigate to external/NuGet assemblies without source
  • Partial classes may only return one location

Dependencies

Notes

This is Phase 3 of the LSP-style navigation tools feature.

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