@@ -270,6 +270,114 @@ if errors.Is(err, errInvalidPKCE) {
270270-Test both positive and negative cases
271271-Use ` testutil.WaitLong` for timeouts in tests
272272
273+ ##Code Navigation andInvestigation
274+
275+ ###Using Go LSP Tools (STRONGLYRECOMMENDED )
276+
277+ **IMPORTANT**:Always useGo LSP toolsfor code navigation and understanding.These tools provide accurate, real-time analysis of the codebase and should be your first choicefor code investigation.
278+
279+ When working with theCoder codebase, leverageGo Language Server Protocol toolsfor efficient code navigation:
280+
281+ 1 . **Find function definitions** (USETHIS FREQUENTLY ):
282+
283+ ` ` ` none
284+ mcp__go-language-server__definition symbolName
285+ ` ` `
286+
287+ -Example :` mcp__go-language-server__definition getOAuth2ProviderAppAuthorize`
288+ -Example :` mcp__go-language-server__definition ExtractAPIKeyMW`
289+ -Quickly jump to function implementations across packages
290+ - **Use this when**:You see a function call and want to understand its implementation
291+ - **Tip**:Include package prefixif symbol isambiguous (e.g .,` httpmw.ExtractAPIKeyMW` )
292+
293+ 2 . **Find symbol references** (ESSENTIALFOR UNDERSTANDING IMPACT ):
294+
295+ ` ` ` none
296+ mcp__go-language-server__references symbolName
297+ ` ` `
298+
299+ -Example :` mcp__go-language-server__references APITokenFromRequest`
300+ -Locate all usages of functions, types, or variables
301+ -Understand code dependencies and call patterns
302+ - **Use this when**:Making changes to understand what code might be affected
303+ - **Criticalfor **:Refactoring , deprecating functions, or understanding data flow
304+
305+ 3 . **Get symbol information** (HELPFULFOR TYPE INFO ):
306+
307+ ` ` ` none
308+ mcp__go-language-server__hover filePath line column
309+ ` ` `
310+
311+ -Example :` mcp__go-language-server__hover /Users/thomask33/Projects/coder/coderd/httpmw/apikey.go 560 25`
312+ -Get type information and documentation at specific positions
313+ - **Use this when**:You need to understand thetype of a variable orreturn value
314+
315+ 4 . **Edit files usingLSP ** (WHENMAKING TARGETED CHANGES ):
316+
317+ ` ` ` none
318+ mcp__go-language-server__edit_file filePath edits
319+ ` ` `
320+
321+ -Make precise edits using line numbers
322+ - **Use this when**:You need to make small, targeted changes to specific lines
323+
324+ 5 . **Get diagnostics** (ALWAYSCHECK AFTER CHANGES ):
325+
326+ ` ` ` none
327+ mcp__go-language-server__diagnostics filePath
328+ ` ` `
329+
330+ -Check for compilation errors, unused imports, etc.
331+ - **Use this when**:After making changes to ensure code is still valid
332+
333+ ###LSP Tool Usage Priority
334+
335+ **ALWAYSUSE THESE TOOLS FIRST **:
336+
337+ - **UseLSP ` definition` ** instead of manual searchingfor function implementations
338+ - **UseLSP ` references` ** instead of grep when lookingfor function/type usage
339+ - **UseLSP ` hover` ** to understand types and signatures
340+ - **UseLSP ` diagnostics` ** after making changes to checkfor errors
341+
342+ **When to use other tools**:
343+
344+ - **UseGrep for **:Text -based searches, finding patterns across files, searching comments
345+ - **UseBash for **:Running tests, git commands, build operations
346+ - **UseRead toolfor **:Reading configuration files, documentation, non-Go files
347+
348+ ###Investigation Strategy (LSP-FirstApproach )
349+
350+ 1 . **Start with route registration** in` coderd/coderd.go` to understandAPI endpoints
351+ 2 . **UseLSP ` definition` lookup** to trace from route handlers to actual implementations
352+ 3 . **UseLSP ` references` ** to understand how functions are called throughout the codebase
353+ 4 . **Follow the middleware chain** usingLSP tools to understand request processing flow
354+ 5 . **Check test files**for expected behavior anderror patterns
355+ 6 . **UseLSP ` diagnostics` ** to ensure your changes don' t break compilation
356+
357+ ### Common LSP Workflows
358+
359+ **Understanding a new feature**:
360+
361+ 1. Use `grep` to find the main entry point (e.g., route registration)
362+ 2. Use LSP `definition` to jump to handler implementation
363+ 3. Use LSP `references` to see how the handler is used
364+ 4. Use LSP `definition` on each function call within the handler
365+
366+ **Making changes to existing code**:
367+
368+ 1. Use LSP `references` to understand the impact of your changes
369+ 2. Use LSP `definition` to understand the current implementation
370+ 3. Make your changes using `Edit` or LSP `edit_file`
371+ 4. Use LSP `diagnostics` to verify your changes compile correctly
372+ 5. Run tests to ensure functionality still works
373+
374+ **Debugging issues**:
375+
376+ 1. Use LSP `definition` to find the problematic function
377+ 2. Use LSP `references` to trace how the function is called
378+ 3. Use LSP `hover` to understand parameter types and return values
379+ 4. Use `Read` to examine the full context around the issue
380+
273381## Testing Scripts
274382
275383### OAuth2 Test Scripts