@@ -7,7 +7,21 @@ This test exercises mcp tool context.
77-- go.mod --
88module example.com
99
10- -- comment/doc.go --
10+ -- commenttest/main.go --
11+ package main
12+
13+ import(
14+ "example.com/commenttest/comment"
15+ )
16+
17+ func testComment() { //@loc(comment, "test")
18+ comment.Foo("", 0)
19+ function.Foo(0, "")
20+ }
21+
22+ //@mcptool("context", `{}`, comment, output=withComment)
23+
24+ -- commenttest/comment/doc.go --
1125// Copyright 2025 The Go Authors. All rights reserved.
1226// Use of this source code is governed by a BSD-style
1327// license that can be found in the LICENSE file.
@@ -17,17 +31,17 @@ Package doc for package comment.
1731*/
1832package comment
1933
20- -- comment/foo .go --
21- // File doc for foo .go part 1.
34+ -- commenttest/ comment/comment .go --
35+ // File doc for comment .go part 1.
2236package comment
2337
24- // File doc for foo .go part 2.
38+ // File doc for comment .go part 2.
2539import (
2640 // comment for package renaming.
2741 myfmt "fmt"
2842)
2943
30- // File doc for foo .go part 3.
44+ // File doc for comment .go part 3.
3145
3246// Func doc for comment.Foo
3347func Foo(foo string, _ int) {
@@ -36,61 +50,60 @@ func Foo(foo string, _ int) {
3650
3751// Random comment floating around.
3852
39- -- comment.go --
40- package main
41-
42- import(
43- "example.com/comment"
44- )
45-
46- func testComment() { //@loc(comment, "test")
47- comment.Foo("", 0)
48- function.Foo(0, "")
49- }
50-
51- //@mcptool("context", `{}`, comment, output=withComment)
52-
5353-- @withComment --
5454Code blocks are delimited by --->...<--- markers.
5555
56- Current file "comment .go" contains this import declaration:
56+ Current file "main .go" contains this import declaration:
5757--->
5858import(
59- "example.com/comment"
59+ "example.com/commenttest/ comment"
6060)
6161<---
6262
6363The imported packages declare the following symbols:
6464
65- example.com/comment (package comment)
66- doc.go:
67- --->
68- /*
69- Package doc for package comment.
70- */
71- package comment
72-
73- <---
74-
75- foo.go:
65+ example.com/commenttest/comment (package comment)
66+ comment.go:
7667--->
77- // File doc for foo .go part 1.
68+ // File doc for comment .go part 1.
7869package comment
7970
80- // File doc for foo .go part 2.
71+ // File doc for comment .go part 2.
8172import (
8273 // comment for package renaming.
8374 myfmt "fmt"
8475)
8576
86- // File doc for foo .go part 3.
77+ // File doc for comment .go part 3.
8778
8879// Func doc for comment.Foo
8980func Foo(foo string, _ int)
9081
9182<---
9283
93- -- function/foo.go --
84+ doc.go:
85+ --->
86+ /*
87+ Package doc for package comment.
88+ */
89+ package comment
90+
91+ <---
92+
93+ -- functiontest/main.go --
94+ package main
95+
96+ import(
97+ "example.com/functiontest/function"
98+ )
99+
100+ func testFunction() { //@loc(function, "test")
101+ function.Foo(0, "")
102+ }
103+
104+ //@mcptool("context", `{}`, function, output=withFunction)
105+
106+ -- functiontest/function/function.go --
94107package function
95108
96109func Foo(int, string) {}
@@ -109,33 +122,20 @@ func (*Exported) unexported(int) {}
109122
110123func (*Exported) Exported(int) {}
111124
112- -- function.go --
113- package main
114-
115- import(
116- "example.com/function"
117- )
118-
119- func testFunction() { //@loc(function, "test")
120- function.Foo(0, "")
121- }
122-
123- //@mcptool("context", `{}`, function, output=withFunction)
124-
125125-- @withFunction --
126126Code blocks are delimited by --->...<--- markers.
127127
128- Current file "function .go" contains this import declaration:
128+ Current file "main .go" contains this import declaration:
129129--->
130130import(
131- "example.com/function"
131+ "example.com/functiontest/ function"
132132)
133133<---
134134
135135The imported packages declare the following symbols:
136136
137- example.com/function (package function)
138- foo .go:
137+ example.com/functiontest/ function (package function)
138+ function .go:
139139--->
140140package function
141141
@@ -147,18 +147,18 @@ func (*Exported) Exported(int)
147147
148148<---
149149
150- -- type .go --
150+ -- typetest/main .go --
151151package main
152152
153153import(
154- "example.com/types"
154+ "example.com/typetest/ types"
155155)
156156
157157var x types.Exported //@loc(types, "x")
158158
159159//@mcptool("context", `{}`, types, output=withType)
160160
161- -- types/types.go --
161+ -- typetest/ types/types.go --
162162package types
163163
164164// Doc for exported.
@@ -192,16 +192,16 @@ type (
192192-- @withType --
193193Code blocks are delimited by --->...<--- markers.
194194
195- Current file "type .go" contains this import declaration:
195+ Current file "main .go" contains this import declaration:
196196--->
197197import(
198- "example.com/types"
198+ "example.com/typetest/ types"
199199)
200200<---
201201
202202The imported packages declare the following symbols:
203203
204- example.com/types (package types)
204+ example.com/typetest/ types (package types)
205205types.go:
206206--->
207207package types
@@ -229,18 +229,18 @@ type (
229229
230230<---
231231
232- -- value .go --
232+ -- valuetest/main .go --
233233package main
234234
235235import(
236- "example.com/values"
236+ "example.com/valuetest/ values"
237237)
238238
239239var y values.ConstFoo //@loc(values, "y")
240240
241241//@mcptool("context", `{}`, values, output=withValue)
242242
243- -- values/consts.go --
243+ -- valuetest/ values/consts.go --
244244package values
245245
246246const (
@@ -260,7 +260,7 @@ const ConstExported = "Exported" // comment for ConstExported
260260// doc for constUnexported
261261var constUnexported = "unexported" // comment for constUnexported
262262
263- -- values/vars.go --
263+ -- valuetest/ values/vars.go --
264264package values
265265
266266var (
@@ -283,16 +283,16 @@ var varUnexported = "unexported" // comment for varUnexported
283283-- @withValue --
284284Code blocks are delimited by --->...<--- markers.
285285
286- Current file "value .go" contains this import declaration:
286+ Current file "main .go" contains this import declaration:
287287--->
288288import(
289- "example.com/values"
289+ "example.com/valuetest/ values"
290290)
291291<---
292292
293293The imported packages declare the following symbols:
294294
295- example.com/values (package values)
295+ example.com/valuetest/ values (package values)
296296consts.go:
297297--->
298298package values
0 commit comments