Optimize LSP tool descriptions for token efficiency (#71)
* bump up dependencies * Optimize LSP tool descriptions for token efficiency - Reduce verbose descriptions to concise versions (~63% character reduction) - Minimize parameter descriptions (1826 → 671 characters) - Remove redundant describe() calls for self-explanatory parameters - Total: ~390 tokens saved from system prompts 🤖 GENERATED WITH ASSISTANCE OF [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
This commit is contained in:
10
bun.lock
10
bun.lock
@@ -7,9 +7,9 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ast-grep/cli": "^0.40.0",
|
"@ast-grep/cli": "^0.40.0",
|
||||||
"@ast-grep/napi": "^0.40.0",
|
"@ast-grep/napi": "^0.40.0",
|
||||||
"@code-yeongyu/comment-checker": "^0.5.0",
|
"@code-yeongyu/comment-checker": "^0.6.0",
|
||||||
"@openauthjs/openauth": "^0.4.3",
|
"@openauthjs/openauth": "^0.4.3",
|
||||||
"@opencode-ai/plugin": "^1.0.150",
|
"@opencode-ai/plugin": "^1.0.162",
|
||||||
"hono": "^4.10.4",
|
"hono": "^4.10.4",
|
||||||
"picomatch": "^4.0.2",
|
"picomatch": "^4.0.2",
|
||||||
"xdg-basedir": "^5.1.0",
|
"xdg-basedir": "^5.1.0",
|
||||||
@@ -68,13 +68,13 @@
|
|||||||
|
|
||||||
"@ast-grep/napi-win32-x64-msvc": ["@ast-grep/napi-win32-x64-msvc@0.40.0", "", { "os": "win32", "cpu": "x64" }, "sha512-Hk2IwfPqMFGZt5SRxsoWmGLxBXxprow4LRp1eG6V8EEiJCNHxZ9ZiEaIc5bNvMDBjHVSnqZAXT22dROhrcSKQg=="],
|
"@ast-grep/napi-win32-x64-msvc": ["@ast-grep/napi-win32-x64-msvc@0.40.0", "", { "os": "win32", "cpu": "x64" }, "sha512-Hk2IwfPqMFGZt5SRxsoWmGLxBXxprow4LRp1eG6V8EEiJCNHxZ9ZiEaIc5bNvMDBjHVSnqZAXT22dROhrcSKQg=="],
|
||||||
|
|
||||||
"@code-yeongyu/comment-checker": ["@code-yeongyu/comment-checker@0.5.0", "", { "os": [ "linux", "win32", "darwin", ], "cpu": [ "x64", "arm64", ], "bin": { "comment-checker": "bin/comment-checker" } }, "sha512-rKD2qQnTVUacsVQtpu3I5Sxi09X/XpOwS9fcmbUv1yfUL6llraaPuLmmxMBMRcmm7Zu31yEPVKCeUkVODfRL1g=="],
|
"@code-yeongyu/comment-checker": ["@code-yeongyu/comment-checker@0.6.0", "", { "os": [ "linux", "win32", "darwin", ], "cpu": [ "x64", "arm64", ], "bin": { "comment-checker": "bin/comment-checker" } }, "sha512-VtDPrhbUJcb5BIS18VMcY/N/xSLbMr6dpU9MO1NYQyEDhI4pSIx07K4gOlCutG/nHVCjO+HEarn8rttODP+5UA=="],
|
||||||
|
|
||||||
"@openauthjs/openauth": ["@openauthjs/openauth@0.4.3", "", { "dependencies": { "@standard-schema/spec": "1.0.0-beta.3", "aws4fetch": "1.0.20", "jose": "5.9.6" }, "peerDependencies": { "arctic": "^2.2.2", "hono": "^4.0.0" } }, "sha512-RlnjqvHzqcbFVymEwhlUEuac4utA5h4nhSK/i2szZuQmxTIqbGUxZ+nM+avM+VV4Ing+/ZaNLKILoXS3yrkOOw=="],
|
"@openauthjs/openauth": ["@openauthjs/openauth@0.4.3", "", { "dependencies": { "@standard-schema/spec": "1.0.0-beta.3", "aws4fetch": "1.0.20", "jose": "5.9.6" }, "peerDependencies": { "arctic": "^2.2.2", "hono": "^4.0.0" } }, "sha512-RlnjqvHzqcbFVymEwhlUEuac4utA5h4nhSK/i2szZuQmxTIqbGUxZ+nM+avM+VV4Ing+/ZaNLKILoXS3yrkOOw=="],
|
||||||
|
|
||||||
"@opencode-ai/plugin": ["@opencode-ai/plugin@1.0.150", "", { "dependencies": { "@opencode-ai/sdk": "1.0.150", "zod": "4.1.8" } }, "sha512-XmY3yydk120GBv2KeLxSZlElFx4Zx9TYLa3bS9X1TxXot42UeoMLEi3Xa46yboYnWwp4bC9Fu+Gd1E7hypG8Jw=="],
|
"@opencode-ai/plugin": ["@opencode-ai/plugin@1.0.162", "", { "dependencies": { "@opencode-ai/sdk": "1.0.162", "zod": "4.1.8" } }, "sha512-tiJw7SCfSlG/3tY2O0J2UT06OLuazOzsv1zYlFbLxLy/EVedtW0pzxYalO20a4e//vInvOXFkhd2jLyB5vNEVA=="],
|
||||||
|
|
||||||
"@opencode-ai/sdk": ["@opencode-ai/sdk@1.0.150", "", {}, "sha512-Nz9Di8UD/GK01w3N+jpiGNB733pYkNY8RNLbuE/HUxEGSP5apbXBY0IdhbW7859sXZZK38kF1NqOx4UxwBf4Bw=="],
|
"@opencode-ai/sdk": ["@opencode-ai/sdk@1.0.162", "", {}, "sha512-+XqRErBUt9eb1m3i/7WkZc/QCKCCjTaGV3MvhLhs/CUwbUn767D/ugzcG/i2ec8j/4nQmjJbjPDRmrQfvF1Qjw=="],
|
||||||
|
|
||||||
"@oslojs/asn1": ["@oslojs/asn1@1.0.0", "", { "dependencies": { "@oslojs/binary": "1.0.0" } }, "sha512-zw/wn0sj0j0QKbIXfIlnEcTviaCzYOY3V5rAyjR6YtOByFtJiT574+8p9Wlach0lZH9fddD4yb9laEAIl4vXQA=="],
|
"@oslojs/asn1": ["@oslojs/asn1@1.0.0", "", { "dependencies": { "@oslojs/binary": "1.0.0" } }, "sha512-zw/wn0sj0j0QKbIXfIlnEcTviaCzYOY3V5rAyjR6YtOByFtJiT574+8p9Wlach0lZH9fddD4yb9laEAIl4vXQA=="],
|
||||||
|
|
||||||
|
|||||||
@@ -48,9 +48,9 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ast-grep/cli": "^0.40.0",
|
"@ast-grep/cli": "^0.40.0",
|
||||||
"@ast-grep/napi": "^0.40.0",
|
"@ast-grep/napi": "^0.40.0",
|
||||||
"@code-yeongyu/comment-checker": "^0.5.0",
|
"@code-yeongyu/comment-checker": "^0.6.0",
|
||||||
"@openauthjs/openauth": "^0.4.3",
|
"@openauthjs/openauth": "^0.4.3",
|
||||||
"@opencode-ai/plugin": "^1.0.150",
|
"@opencode-ai/plugin": "^1.0.162",
|
||||||
"hono": "^4.10.4",
|
"hono": "^4.10.4",
|
||||||
"picomatch": "^4.0.2",
|
"picomatch": "^4.0.2",
|
||||||
"xdg-basedir": "^5.1.0",
|
"xdg-basedir": "^5.1.0",
|
||||||
|
|||||||
@@ -35,12 +35,11 @@ import type {
|
|||||||
|
|
||||||
|
|
||||||
export const lsp_hover = tool({
|
export const lsp_hover = tool({
|
||||||
description:
|
description: "Get type info, docs, and signature for a symbol at position.",
|
||||||
"Get type information, documentation, and signature for a symbol at a specific position in a file. Use this when you need to understand what a variable, function, class, or any identifier represents.",
|
|
||||||
args: {
|
args: {
|
||||||
filePath: tool.schema.string().describe("The absolute path to the file"),
|
filePath: tool.schema.string(),
|
||||||
line: tool.schema.number().min(1).describe("Line number (1-based)"),
|
line: tool.schema.number().min(1).describe("1-based"),
|
||||||
character: tool.schema.number().min(0).describe("Character position (0-based)"),
|
character: tool.schema.number().min(0).describe("0-based"),
|
||||||
},
|
},
|
||||||
execute: async (args, context) => {
|
execute: async (args, context) => {
|
||||||
try {
|
try {
|
||||||
@@ -57,12 +56,11 @@ export const lsp_hover = tool({
|
|||||||
})
|
})
|
||||||
|
|
||||||
export const lsp_goto_definition = tool({
|
export const lsp_goto_definition = tool({
|
||||||
description:
|
description: "Jump to symbol definition. Find WHERE something is defined.",
|
||||||
"Jump to the source definition of a symbol (variable, function, class, type, import, etc.). Use this when you need to find WHERE something is defined.",
|
|
||||||
args: {
|
args: {
|
||||||
filePath: tool.schema.string().describe("The absolute path to the file"),
|
filePath: tool.schema.string(),
|
||||||
line: tool.schema.number().min(1).describe("Line number (1-based)"),
|
line: tool.schema.number().min(1).describe("1-based"),
|
||||||
character: tool.schema.number().min(0).describe("Character position (0-based)"),
|
character: tool.schema.number().min(0).describe("0-based"),
|
||||||
},
|
},
|
||||||
execute: async (args, context) => {
|
execute: async (args, context) => {
|
||||||
try {
|
try {
|
||||||
@@ -95,12 +93,11 @@ export const lsp_goto_definition = tool({
|
|||||||
})
|
})
|
||||||
|
|
||||||
export const lsp_find_references = tool({
|
export const lsp_find_references = tool({
|
||||||
description:
|
description: "Find ALL usages/references of a symbol across the entire workspace.",
|
||||||
"Find ALL usages/references of a symbol across the entire workspace. Use this when you need to understand the impact of changing something.",
|
|
||||||
args: {
|
args: {
|
||||||
filePath: tool.schema.string().describe("The absolute path to the file"),
|
filePath: tool.schema.string(),
|
||||||
line: tool.schema.number().min(1).describe("Line number (1-based)"),
|
line: tool.schema.number().min(1).describe("1-based"),
|
||||||
character: tool.schema.number().min(0).describe("Character position (0-based)"),
|
character: tool.schema.number().min(0).describe("0-based"),
|
||||||
includeDeclaration: tool.schema.boolean().optional().describe("Include the declaration itself"),
|
includeDeclaration: tool.schema.boolean().optional().describe("Include the declaration itself"),
|
||||||
},
|
},
|
||||||
execute: async (args, context) => {
|
execute: async (args, context) => {
|
||||||
@@ -133,10 +130,9 @@ export const lsp_find_references = tool({
|
|||||||
})
|
})
|
||||||
|
|
||||||
export const lsp_document_symbols = tool({
|
export const lsp_document_symbols = tool({
|
||||||
description:
|
description: "Get hierarchical outline of all symbols in a file.",
|
||||||
"Get a hierarchical outline of all symbols (classes, functions, methods, variables, types, constants) in a single file. Use this to quickly understand a file's structure.",
|
|
||||||
args: {
|
args: {
|
||||||
filePath: tool.schema.string().describe("The absolute path to the file"),
|
filePath: tool.schema.string(),
|
||||||
},
|
},
|
||||||
execute: async (args, context) => {
|
execute: async (args, context) => {
|
||||||
try {
|
try {
|
||||||
@@ -172,12 +168,11 @@ export const lsp_document_symbols = tool({
|
|||||||
})
|
})
|
||||||
|
|
||||||
export const lsp_workspace_symbols = tool({
|
export const lsp_workspace_symbols = tool({
|
||||||
description:
|
description: "Search symbols by name across ENTIRE workspace.",
|
||||||
"Search for symbols by name across the ENTIRE workspace/project. Use this when you know (or partially know) a symbol's name but don't know which file it's in.",
|
|
||||||
args: {
|
args: {
|
||||||
filePath: tool.schema.string().describe("A file path in the workspace to determine the workspace root"),
|
filePath: tool.schema.string(),
|
||||||
query: tool.schema.string().describe("The symbol name to search for (supports fuzzy matching)"),
|
query: tool.schema.string().describe("Symbol name (fuzzy match)"),
|
||||||
limit: tool.schema.number().optional().describe("Maximum number of results to return"),
|
limit: tool.schema.number().optional().describe("Max results"),
|
||||||
},
|
},
|
||||||
execute: async (args, context) => {
|
execute: async (args, context) => {
|
||||||
try {
|
try {
|
||||||
@@ -208,10 +203,9 @@ export const lsp_workspace_symbols = tool({
|
|||||||
})
|
})
|
||||||
|
|
||||||
export const lsp_diagnostics = tool({
|
export const lsp_diagnostics = tool({
|
||||||
description:
|
description: "Get errors, warnings, hints from language server BEFORE running build.",
|
||||||
"Get all errors, warnings, and hints for a file from the language server. Use this to check if code has type errors, syntax issues, or linting problems BEFORE running the build.",
|
|
||||||
args: {
|
args: {
|
||||||
filePath: tool.schema.string().describe("The absolute path to the file"),
|
filePath: tool.schema.string(),
|
||||||
severity: tool.schema
|
severity: tool.schema
|
||||||
.enum(["error", "warning", "information", "hint", "all"])
|
.enum(["error", "warning", "information", "hint", "all"])
|
||||||
.optional()
|
.optional()
|
||||||
@@ -256,7 +250,7 @@ export const lsp_diagnostics = tool({
|
|||||||
})
|
})
|
||||||
|
|
||||||
export const lsp_servers = tool({
|
export const lsp_servers = tool({
|
||||||
description: "List all available LSP servers and check if they are installed. Use this to see what language support is available.",
|
description: "List available LSP servers and installation status.",
|
||||||
args: {},
|
args: {},
|
||||||
execute: async (_args, context) => {
|
execute: async (_args, context) => {
|
||||||
try {
|
try {
|
||||||
@@ -278,12 +272,11 @@ export const lsp_servers = tool({
|
|||||||
})
|
})
|
||||||
|
|
||||||
export const lsp_prepare_rename = tool({
|
export const lsp_prepare_rename = tool({
|
||||||
description:
|
description: "Check if rename is valid. Use BEFORE lsp_rename.",
|
||||||
"Check if a symbol at a specific position can be renamed. Use this BEFORE attempting to rename to validate the operation and get the current symbol name.",
|
|
||||||
args: {
|
args: {
|
||||||
filePath: tool.schema.string().describe("The absolute path to the file"),
|
filePath: tool.schema.string(),
|
||||||
line: tool.schema.number().min(1).describe("Line number (1-based)"),
|
line: tool.schema.number().min(1).describe("1-based"),
|
||||||
character: tool.schema.number().min(0).describe("Character position (0-based)"),
|
character: tool.schema.number().min(0).describe("0-based"),
|
||||||
},
|
},
|
||||||
execute: async (args, context) => {
|
execute: async (args, context) => {
|
||||||
try {
|
try {
|
||||||
@@ -303,13 +296,12 @@ export const lsp_prepare_rename = tool({
|
|||||||
})
|
})
|
||||||
|
|
||||||
export const lsp_rename = tool({
|
export const lsp_rename = tool({
|
||||||
description:
|
description: "Rename symbol across entire workspace. APPLIES changes to all files.",
|
||||||
"Rename a symbol across the entire workspace. This APPLIES the rename to all files. Use lsp_prepare_rename first to check if rename is possible.",
|
|
||||||
args: {
|
args: {
|
||||||
filePath: tool.schema.string().describe("The absolute path to the file"),
|
filePath: tool.schema.string(),
|
||||||
line: tool.schema.number().min(1).describe("Line number (1-based)"),
|
line: tool.schema.number().min(1).describe("1-based"),
|
||||||
character: tool.schema.number().min(0).describe("Character position (0-based)"),
|
character: tool.schema.number().min(0).describe("0-based"),
|
||||||
newName: tool.schema.string().describe("The new name for the symbol"),
|
newName: tool.schema.string().describe("New symbol name"),
|
||||||
},
|
},
|
||||||
execute: async (args, context) => {
|
execute: async (args, context) => {
|
||||||
try {
|
try {
|
||||||
@@ -327,14 +319,13 @@ export const lsp_rename = tool({
|
|||||||
})
|
})
|
||||||
|
|
||||||
export const lsp_code_actions = tool({
|
export const lsp_code_actions = tool({
|
||||||
description:
|
description: "Get available quick fixes, refactorings, and source actions (organize imports, fix all).",
|
||||||
"Get available code actions for a range in the file. Code actions include quick fixes, refactorings (extract, inline, rewrite), and source actions (organize imports, fix all). Use this to discover what automated changes the language server can perform.",
|
|
||||||
args: {
|
args: {
|
||||||
filePath: tool.schema.string().describe("The absolute path to the file"),
|
filePath: tool.schema.string(),
|
||||||
startLine: tool.schema.number().min(1).describe("Start line number (1-based)"),
|
startLine: tool.schema.number().min(1).describe("1-based"),
|
||||||
startCharacter: tool.schema.number().min(0).describe("Start character position (0-based)"),
|
startCharacter: tool.schema.number().min(0).describe("0-based"),
|
||||||
endLine: tool.schema.number().min(1).describe("End line number (1-based)"),
|
endLine: tool.schema.number().min(1).describe("1-based"),
|
||||||
endCharacter: tool.schema.number().min(0).describe("End character position (0-based)"),
|
endCharacter: tool.schema.number().min(0).describe("0-based"),
|
||||||
kind: tool.schema
|
kind: tool.schema
|
||||||
.enum([
|
.enum([
|
||||||
"quickfix",
|
"quickfix",
|
||||||
@@ -372,13 +363,10 @@ export const lsp_code_actions = tool({
|
|||||||
})
|
})
|
||||||
|
|
||||||
export const lsp_code_action_resolve = tool({
|
export const lsp_code_action_resolve = tool({
|
||||||
description:
|
description: "Resolve and APPLY a code action from lsp_code_actions.",
|
||||||
"Resolve and APPLY a code action. This resolves the full details and applies the changes to files. Use after getting a code action from lsp_code_actions.",
|
|
||||||
args: {
|
args: {
|
||||||
filePath: tool.schema
|
filePath: tool.schema.string(),
|
||||||
.string()
|
codeAction: tool.schema.string().describe("Code action JSON from lsp_code_actions"),
|
||||||
.describe("The absolute path to a file in the workspace (used to find the LSP server)"),
|
|
||||||
codeAction: tool.schema.string().describe("The code action JSON object as returned by lsp_code_actions (stringified)"),
|
|
||||||
},
|
},
|
||||||
execute: async (args, context) => {
|
execute: async (args, context) => {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user