| 1 |
This test exercises the "go_references" MCP tool. |
| 2 |
|
| 3 |
-- flags -- |
| 4 |
-mcp |
| 5 |
-ignore_extra_diags |
| 6 |
|
| 7 |
-- go.mod -- |
| 8 |
module example.com |
| 9 |
|
| 10 |
-- settings.json -- |
| 11 |
{ |
| 12 |
"mcpTools": { |
| 13 |
"go_references": true |
| 14 |
} |
| 15 |
} |
| 16 |
|
| 17 |
-- a/a.go -- |
| 18 |
package a |
| 19 |
|
| 20 |
func Foo() {} //@loc(Foo, "Foo") |
| 21 |
|
| 22 |
func callFoo() { |
| 23 |
Foo() |
| 24 |
} |
| 25 |
|
| 26 |
-- b/b.go -- |
| 27 |
package b |
| 28 |
|
| 29 |
import "example.com/a" |
| 30 |
|
| 31 |
func callFoo() { |
| 32 |
a.Foo() |
| 33 |
} |
| 34 |
|
| 35 |
//@mcptool("go_references", `{}`, location=Foo, output=threeref) |
| 36 |
|
| 37 |
-- @threeref -- |
| 38 |
The object has 3 references. Their locations are listed below |
| 39 |
Reference 1 |
| 40 |
Located in the file: $WORKDIR/a/a.go |
| 41 |
The reference is located on line 2, which has content `func Foo() {} //@loc(Foo, "Foo")` |
| 42 |
|
| 43 |
Reference 2 |
| 44 |
Located in the file: $WORKDIR/a/a.go |
| 45 |
The reference is located on line 5, which has content `Foo()` |
| 46 |
|
| 47 |
Reference 3 |
| 48 |
Located in the file: $WORKDIR/b/b.go |
| 49 |
The reference is located on line 5, which has content `a.Foo()` |
| 50 |
|