[tools] gopls/internal/mcp: skip standard lib package summary in context tool

0 views
Skip to first unread message

Gopher Robot (Gerrit)

unread,
Jul 8, 2025, 1:41:41 PMJul 8
to Hongxiang Jiang, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Go LUCI, Robert Findley, golang-co...@googlegroups.com

Gopher Robot submitted the change with unreviewed changes

Unreviewed changes

1 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:

```
The name of the file: gopls/internal/test/marker/testdata/mcptools/context.txt
Insertions: 3, Deletions: 5.

@@ -69,12 +69,10 @@
// Random comment floating around.

-- @withComment --
-Code blocks are delimited by --->...<--- markers.
-
-Current package "example.com/a" (package main) declares the following symbols:
+Current package "example.com/a" (package main):

main.go (current file):
---->
+```go
// File doc for main.go part 1.
package main

@@ -88,10 +86,10 @@
// doc comment for func foo.
func foo()

-<---
+```

a.go:
---->
+```go
// File doc for a.go.
package main

@@ -104,7 +102,7 @@
const c = ""
// doc comment for var d.
var d int
-<---
+```

Current file "main.go" contains this import declaration:
--->
@@ -174,12 +172,10 @@
func (*Exported) Exported(int) {}

-- @withFunction --
-Code blocks are delimited by --->...<--- markers.
-
-Current package "example.com/b" (package main) declares the following symbols:
+Current package "example.com/b" (package main):

main.go (current file):
---->
+```go
package main

import(
@@ -188,7 +184,7 @@

func testFunction()

-<---
+```

Current file "main.go" contains this import declaration:
--->
@@ -253,12 +249,10 @@
)

-- @withType --
-Code blocks are delimited by --->...<--- markers.
-
-Current package "example.com/c" (package main) declares the following symbols:
+Current package "example.com/c" (package main):

main.go (current file):
---->
+```go
package main

import(
@@ -266,7 +260,7 @@
)

var x types.Exported
-<---
+```

Current file "main.go" contains this import declaration:
--->
@@ -355,12 +349,10 @@
var varUnexported = "unexported" // comment for varUnexported

-- @withValue --
-Code blocks are delimited by --->...<--- markers.
-
-Current package "example.com/d" (package main) declares the following symbols:
+Current package "example.com/d" (package main):

main.go (current file):
---->
+```go
package main

import(
@@ -368,7 +360,7 @@
)

var y values.ConstFoo
-<---
+```

Current file "main.go" contains this import declaration:
--->
@@ -445,47 +437,45 @@
}

-- @samePackage --
-Code blocks are delimited by --->...<--- markers.
-
-Current package "example.com/e" (package main) declares the following symbols:
+Current package "example.com/e" (package main):

main.go (current file):
---->
+```go
package main

func main()

-<---
+```

bar.go:
---->
+```go
package main

const (
bar = ""
Bar = ""
)
-<---
+```

baz.go:
---->
+```go
package main

func baz(int) string

func Baz(string) int

-<---
+```

foo.go:
---->
+```go
package main

var (
foo string
Foo string
)
-<---
+```

-- f/main.go --
package main
@@ -497,19 +487,17 @@
}

-- @withoutStdLib --
-Code blocks are delimited by --->...<--- markers.
-
-Current package "example.com/f" (package main) declares the following symbols:
+Current package "example.com/f" (package main):

main.go (current file):
---->
+```go
package main

import "fmt"

func Foo()

-<---
+```

Current file "main.go" contains this import declaration:
--->
```

Change information

Commit message:
gopls/internal/mcp: skip standard lib package summary in context tool

The standard library have a lot exported symbols and doc comments
which could use a lot of tokens.
Change-Id: Idc1e153678b459efa4347534eae9c80bdff84430
Auto-Submit: Hongxiang Jiang <hxj...@golang.org>
Reviewed-by: Robert Findley <rfin...@google.com>
Files:
  • M gopls/internal/mcp/context.go
  • M gopls/internal/test/marker/testdata/mcptools/context.txt
Change size: S
Delta: 2 files changed, 41 insertions(+), 2 deletions(-)
Branch: refs/heads/master
Submit Requirements:
  • requirement satisfiedCode-Review: +2 by Robert Findley
  • requirement satisfiedTryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: tools
Gerrit-Branch: master
Gerrit-Change-Id: Idc1e153678b459efa4347534eae9c80bdff84430
Gerrit-Change-Number: 686336
Gerrit-PatchSet: 3
Gerrit-Owner: Hongxiang Jiang <hxj...@golang.org>
Gerrit-Reviewer: Gopher Robot <go...@golang.org>
Gerrit-Reviewer: Hongxiang Jiang <hxj...@golang.org>
Gerrit-Reviewer: Robert Findley <rfin...@google.com>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages