| This test exercises the "go_references" MCP tool. |
| |
| -- flags -- |
| -mcp |
| -ignore_extra_diags |
| |
| -- go.mod -- |
| module example.com |
| |
| -- settings.json -- |
| { |
| "mcpTools": { |
| "go_references": true |
| } |
| } |
| |
| -- a/a.go -- |
| package a |
| |
| func Foo() {} //@loc(Foo, "Foo") |
| |
| func callFoo() { |
| Foo() |
| } |
| |
| -- b/b.go -- |
| package b |
| |
| import "example.com/a" |
| |
| func callFoo() { |
| a.Foo() |
| } |
| |
| //@mcptool("go_references", `{}`, location=Foo, output=threeref) |
| |
| -- @threeref -- |
| The object has 3 references. Their locations are listed below |
| Reference 1 |
| Located in the file: $WORKDIR/a/a.go |
| The reference is located on line 2, which has content `func Foo() {} //@loc(Foo, "Foo")` |
| |
| Reference 2 |
| Located in the file: $WORKDIR/a/a.go |
| The reference is located on line 5, which has content `Foo()` |
| |
| Reference 3 |
| Located in the file: $WORKDIR/b/b.go |
| The reference is located on line 5, which has content `a.Foo()` |
| |