Skip to content

Commit d90a343

Browse files
findleyrgopherbot
authored andcommitted
gopls/internal/mcp: a couple more small improvements to instructions
From testing, tweak a couple instructions that tend to cause agents to slip up: - 'exported symbols' is misinterpreted. Just find references to all symbols. - Note that the source cited in diagnostic messages does not necessarily match the real source (I had Gemini enter an edit loop because it couldn't find the source to replace) Change-Id: Ib78ec409e4daeeecb8879b20f7767104a77dba61 Reviewed-on: https://go-review.googlesource.com/c/tools/+/687455 Auto-Submit: Robert Findley <[email protected]> Reviewed-by: Madeline Kalil <[email protected]> Reviewed-by: Hongxiang Jiang <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent 50ec2f1 commit d90a343

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

gopls/internal/mcp/instructions.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,15 @@ The editing workflow is iterative. You should cycle through these steps until th
3333

3434
1. **Read first**: Before making any edits, follow the Read Workflow to understand the user's request and the relevant code.
3535

36-
2. **Find references**: Before modifying the definition of any exported symbol, use the `go_symbol_references` tool to find all references to that identifier. This is critical for understanding the impact of your change. Read the files containing references to evaluate if any further edits are required.
36+
2. **Find references**: Before modifying the definition of any symbol, use the `go_symbol_references` tool to find all references to that identifier. This is critical for understanding the impact of your change. Read the files containing references to evaluate if any further edits are required.
3737
EXAMPLE: `go_symbol_references({"file":"/path/to/server.go","symbol":"Server.Run"})`
3838

3939
3. **Make edits**: Make the primary edit, as well as any edits to references you identified in the previous step.
4040

4141
4. **Check for errors**: After every code modification, you MUST call the `go_diagnostics` tool. Pass the paths of the files you have edited. This tool will report any build or analysis errors.
4242
EXAMPLE: `go_diagnostics({"files":["/path/to/server.go"]})`
4343

44-
5. **Fix errors**: If `go_diagnostics` reports any errors, fix them. The tool may provide suggested quick fixes in the form of diffs. You should review these diffs and apply them if they are correct. Once you've applied a fix, re-run `go_diagnostics` to confirm that the issue is resolved. It is OK to ignore 'hint' or 'info' diagnostics if they are not relevant to the current task.
44+
5. **Fix errors**: If `go_diagnostics` reports any errors, fix them. The tool may provide suggested quick fixes in the form of diffs. You should review these diffs and apply them if they are correct. Once you've applied a fix, re-run `go_diagnostics` to confirm that the issue is resolved. It is OK to ignore 'hint' or 'info' diagnostics if they are not relevant to the current task. Note that Go diagnostic messages may contain a summary of the source code, which may not match its exact text.
4545

4646
6. **Run tests**: Once `go_diagnostics` reports no errors (and ONLY once there are no errors), run the tests for the packages you have changed. You can do this with `go test [packagePath...]`. Don't run `go test ./...` unless the user explicitly requests it, as doing so may slow down the iteration loop.
47+

0 commit comments

Comments
 (0)