| 1 |
This test exercises the "go_file_context" MCP tool. |
| 2 |
|
| 3 |
-- flags -- |
| 4 |
-mcp |
| 5 |
-ignore_extra_diags |
| 6 |
|
| 7 |
-- go.mod -- |
| 8 |
module example.com |
| 9 |
|
| 10 |
-- a/main.go -- |
| 11 |
package main |
| 12 |
|
| 13 |
import "example.com/a/other" |
| 14 |
|
| 15 |
func main() { //@mcptool("go_file_context", `{"file": "$WORKDIR/a/main.go"}`, output=content) |
| 16 |
other.Foo() |
| 17 |
_ = other.Bar |
| 18 |
} |
| 19 |
|
| 20 |
-- a/other/other.go -- |
| 21 |
package other |
| 22 |
|
| 23 |
// Foo should have a doc comment. |
| 24 |
func Foo() { |
| 25 |
// The body should be ignored |
| 26 |
} |
| 27 |
|
| 28 |
var Bar int // line comments get dropped |
| 29 |
|
| 30 |
var Baz string // Baz is not referenced |
| 31 |
|
| 32 |
-- @content -- |
| 33 |
File `$WORKDIR/a/main.go` is in package "example.com/a". |
| 34 |
Below is a summary of the APIs it uses from other files. |
| 35 |
To read the full API of any package, use go_package_api. |
| 36 |
Referenced declarations from $WORKDIR/a/other/other.go (package "example.com/a/other"): |
| 37 |
```go |
| 38 |
// Foo should have a doc comment. |
| 39 |
func Foo() |
| 40 |
|
| 41 |
var Bar int |
| 42 |
``` |
| 43 |
|