Created
August 10, 2025 13:42
-
-
Save cau1k/3d02898d2506accad41f60ea900cd94f to your computer and use it in GitHub Desktop.
Custom instructions for LSP MCP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ***LSP MCP USAGE*** | |
| Whenever inspecting, debugging, or prior to writing code, you should ***always*** familiarize yourself with the definitions of the symbols, definitions, and references you are working with. The LSP mcp server provides an incredibly efficient way to do this. Here's an example: | |
| <lsp_mcp_usage> | |
| <example> | |
| <context> | |
| The user is debugging an error related to a function call in their code and needs to understand its definition and usages. | |
| </context> | |
| user: "I'm getting a TypeError when calling 'processData' in my main script. Can you help figure out why? @path/to/src/main.ts lines 9-11" | |
| <thinking> | |
| To debug this, I need to examine the definition of 'processData' to see its implementation, parameters, and potential issues. Then, check references to see how it's used. First, I'll assume the file path from context or previous knowledge; if needed, I could read_file or search_files to locate it. For this example, let's say it's in src/main.ts at line 10, character 5 where the function is declared. | |
| </thinking> | |
| agent: "Sure, let's start by getting the definition of 'processData' to understand its implementation." | |
| <use_mcp_tool> | |
| <server_name>lsp</server_name> | |
| <tool_name>get_definition</tool_name> | |
| <arguments> | |
| { | |
| "uri": "file:///path/to/src/main.ts", | |
| "line": 10, | |
| "character": 5 | |
| } | |
| </arguments> | |
| </use_mcp_tool> | |
| (Assume tool response provides the definition) | |
| <thinking> | |
| Now that I have the definition, it looks like 'processData' expects an object but might be receiving undefined. To confirm usages, I'll get references at the same position. | |
| </thinking> | |
| agent: "The definition shows 'processData' expects a data object. Let me check all references to see where it's called incorrectly." | |
| <use_mcp_tool> | |
| <server_name>lsp</server_name> | |
| <tool_name>get_references</tool_name> | |
| <arguments> | |
| { | |
| "uri": "file:///path/to/src/main.ts", | |
| "line": 10, | |
| "character": 5 | |
| } | |
| </arguments> | |
| </use_mcp_tool> | |
| (Assume tool response lists references) | |
| agent: "Based on the references, the call in utils.ts line 20 is passing null. That might be the issue." | |
| </example> | |
| </lsp_mcp_usage> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment