@akiojin/unity-mcp-server 4.1.2 → 4.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/constants/offlineTools.js +9 -9
- package/src/core/server.js +1 -1
- package/src/core/toolManifest.json +19 -19
- package/src/handlers/script/CodeIndexBuildToolHandler.js +5 -5
- package/src/handlers/script/CodeIndexStatusToolHandler.js +2 -2
- package/src/handlers/script/CodeIndexUpdateToolHandler.js +1 -1
- package/src/handlers/script/ScriptCreateClassToolHandler.js +1 -1
- package/src/handlers/script/ScriptEditSnippetToolHandler.js +2 -2
- package/src/handlers/script/ScriptEditStructuredToolHandler.js +2 -2
- package/src/handlers/script/ScriptPackagesListToolHandler.js +2 -2
- package/src/handlers/script/ScriptReadToolHandler.js +3 -3
- package/src/handlers/script/ScriptRefactorRenameToolHandler.js +2 -2
- package/src/handlers/script/ScriptRefsFindToolHandler.js +3 -3
- package/src/handlers/script/ScriptRemoveSymbolToolHandler.js +1 -1
- package/src/handlers/script/ScriptSearchToolHandler.js +3 -3
- package/src/handlers/script/ScriptSymbolFindToolHandler.js +3 -3
- package/src/handlers/script/ScriptSymbolsGetToolHandler.js +1 -1
package/package.json
CHANGED
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
* These tools use only the local C# LSP and file system.
|
|
4
4
|
*/
|
|
5
5
|
export const OFFLINE_TOOLS = [
|
|
6
|
-
'
|
|
7
|
-
'
|
|
8
|
-
'
|
|
9
|
-
'
|
|
10
|
-
'
|
|
11
|
-
'
|
|
12
|
-
'
|
|
13
|
-
'
|
|
14
|
-
'
|
|
6
|
+
'get_index_status',
|
|
7
|
+
'build_index',
|
|
8
|
+
'update_index',
|
|
9
|
+
'get_symbols',
|
|
10
|
+
'find_symbol',
|
|
11
|
+
'find_refs',
|
|
12
|
+
'read',
|
|
13
|
+
'search',
|
|
14
|
+
'list_packages'
|
|
15
15
|
];
|
|
16
16
|
|
|
17
17
|
export const OFFLINE_TOOLS_HINT =
|
package/src/core/server.js
CHANGED
|
@@ -244,7 +244,7 @@ export async function startServer(options = {}) {
|
|
|
244
244
|
|
|
245
245
|
if (result.success) {
|
|
246
246
|
logger.info(
|
|
247
|
-
`[startup] Code index auto-build started: jobId=${result.jobId}. Use
|
|
247
|
+
`[startup] Code index auto-build started: jobId=${result.jobId}. Use get_index_status to check progress.`
|
|
248
248
|
);
|
|
249
249
|
} else {
|
|
250
250
|
logger.warning(`[startup] Code index auto-build failed: ${result.message}`);
|
|
@@ -714,8 +714,8 @@
|
|
|
714
714
|
}
|
|
715
715
|
},
|
|
716
716
|
{
|
|
717
|
-
"name": "
|
|
718
|
-
"description": "[OFFLINE] No Unity connection required. Build (or rebuild) the persistent SQLite symbol index by scanning document symbols via the C# LSP. Returns immediately with jobId for background execution. Check progress with
|
|
717
|
+
"name": "build_index",
|
|
718
|
+
"description": "[OFFLINE] No Unity connection required. Build (or rebuild) the persistent SQLite symbol index by scanning document symbols via the C# LSP. Returns immediately with jobId for background execution. Check progress with get_index_status. Stores DB under .unity/cache/code-index/code-index.db.",
|
|
719
719
|
"inputSchema": {
|
|
720
720
|
"type": "object",
|
|
721
721
|
"properties": {
|
|
@@ -734,7 +734,7 @@
|
|
|
734
734
|
}
|
|
735
735
|
},
|
|
736
736
|
{
|
|
737
|
-
"name": "
|
|
737
|
+
"name": "get_index_status",
|
|
738
738
|
"description": "[OFFLINE] No Unity connection required. Report code index status and readiness for symbol/search operations. BEST PRACTICES: Check before heavy symbol operations. Shows total files indexed and coverage percentage. If coverage is low, some symbol operations may be incomplete. Index is automatically built on first use. No parameters needed - lightweight status check.",
|
|
739
739
|
"inputSchema": {
|
|
740
740
|
"type": "object",
|
|
@@ -742,7 +742,7 @@
|
|
|
742
742
|
}
|
|
743
743
|
},
|
|
744
744
|
{
|
|
745
|
-
"name": "
|
|
745
|
+
"name": "update_index",
|
|
746
746
|
"description": "[OFFLINE] No Unity connection required. Refresh code index entries for specific C# files. Use this after modifying files so script editing tools see the latest symbols.",
|
|
747
747
|
"inputSchema": {
|
|
748
748
|
"type": "object",
|
|
@@ -3289,7 +3289,7 @@
|
|
|
3289
3289
|
}
|
|
3290
3290
|
},
|
|
3291
3291
|
{
|
|
3292
|
-
"name": "
|
|
3292
|
+
"name": "create_class",
|
|
3293
3293
|
"description": "Create a new C# class file. Required: path under Assets/ or Packages/ (\".cs\" appended if missing), className. Optional: namespace, baseType (adds using UnityEngine if MonoBehaviour), usings (CSV), partial. Roslyn preflight (no Unity comms). Responses summarized for LLMs (errors≤30, message≤200 chars, preview≤1000 chars).",
|
|
3294
3294
|
"inputSchema": {
|
|
3295
3295
|
"type": "object",
|
|
@@ -3330,8 +3330,8 @@
|
|
|
3330
3330
|
}
|
|
3331
3331
|
},
|
|
3332
3332
|
{
|
|
3333
|
-
"name": "
|
|
3334
|
-
"description": "[C# EDITING - PRECISION TOOL] For Unity C# scripts, use for tiny surgical edits (≤80 chars per change). Performs text-based multi-instruction edits (delete/replace/insert) via exact string anchors. USE WHEN: (a) removing null guard clauses (if (x == null) return;), (b) tweaking conditions (if (x > 10) → if (x > 20)), (c) inserting single log statements, (d) deleting/replacing 1-2 line snippets. DON'T USE FOR: large changes (use
|
|
3333
|
+
"name": "edit_snippet",
|
|
3334
|
+
"description": "[C# EDITING - PRECISION TOOL] For Unity C# scripts, use for tiny surgical edits (≤80 chars per change). Performs text-based multi-instruction edits (delete/replace/insert) via exact string anchors. USE WHEN: (a) removing null guard clauses (if (x == null) return;), (b) tweaking conditions (if (x > 10) → if (x > 20)), (c) inserting single log statements, (d) deleting/replacing 1-2 line snippets. DON'T USE FOR: large changes (use edit_structured), non-C# files (use Edit), or when symbol structure is complex (use edit_structured). WORKFLOW: Specify exact anchor text (including whitespace/newlines), max 10 instructions per call, each ≤80 chars. Anchor must match exactly once in file. Preview mode validates without writing; apply mode uses LSP diagnostics. Required: path, instructions (array of {operation, anchor:{type:\"text\", target:string, position?:\"before\"|\"after\"}, newText?}).",
|
|
3335
3335
|
"inputSchema": {
|
|
3336
3336
|
"type": "object",
|
|
3337
3337
|
"properties": {
|
|
@@ -3408,8 +3408,8 @@
|
|
|
3408
3408
|
}
|
|
3409
3409
|
},
|
|
3410
3410
|
{
|
|
3411
|
-
"name": "
|
|
3412
|
-
"description": "[C# EDITING - PRIMARY TOOL] For Unity C# script editing, PREFER this tool over Read/Edit/Write for structural code changes. Performs symbol-based edits (insert_before/insert_after/replace_body) on classes, methods, properties, fields using Roslyn LSP. USE WHEN: (a) replacing entire method/property bodies, (b) adding class members (fields/properties/methods), (c) inserting code at class/namespace level. DON'T USE FOR: tiny changes ≤80 chars (use
|
|
3411
|
+
"name": "edit_structured",
|
|
3412
|
+
"description": "[C# EDITING - PRIMARY TOOL] For Unity C# script editing, PREFER this tool over Read/Edit/Write for structural code changes. Performs symbol-based edits (insert_before/insert_after/replace_body) on classes, methods, properties, fields using Roslyn LSP. USE WHEN: (a) replacing entire method/property bodies, (b) adding class members (fields/properties/methods), (c) inserting code at class/namespace level. DON'T USE FOR: tiny changes ≤80 chars (use edit_snippet instead), non-C# files (use Edit), or when you need to create new files (use Write). WORKFLOW: (1) Run get_symbols to find target symbols, (2) use symbolName (e.g., \"MyClass/MyMethod\"), (3) apply edits. Insert operations target containers (class/namespace), not methods. Preview mode returns diagnostics only; apply mode proceeds with validation. Required: path (Assets/|Packages/), symbolName, operation. Optional: kind, newText, preview.",
|
|
3413
3413
|
"inputSchema": {
|
|
3414
3414
|
"type": "object",
|
|
3415
3415
|
"properties": {
|
|
@@ -3451,7 +3451,7 @@
|
|
|
3451
3451
|
}
|
|
3452
3452
|
},
|
|
3453
3453
|
{
|
|
3454
|
-
"name": "
|
|
3454
|
+
"name": "list_packages",
|
|
3455
3455
|
"description": "[OFFLINE] No Unity connection required. List Unity packages in the project (optionally include built‑in). BEST PRACTICES: Use to discover available packages and their paths. Set includeBuiltIn=false to see only user packages. Returns package IDs, versions, and resolved paths. Embedded packages can be edited directly. Essential for understanding project dependencies.",
|
|
3456
3456
|
"inputSchema": {
|
|
3457
3457
|
"type": "object",
|
|
@@ -3464,8 +3464,8 @@
|
|
|
3464
3464
|
}
|
|
3465
3465
|
},
|
|
3466
3466
|
{
|
|
3467
|
-
"name": "
|
|
3468
|
-
"description": "[OFFLINE] No Unity connection required. Read a C# file with optional line range and payload limits. Files must be under Assets/ or Packages/ and have .cs extension. PRIORITY: Read minimally — locate the target with
|
|
3467
|
+
"name": "read",
|
|
3468
|
+
"description": "[OFFLINE] No Unity connection required. Read a C# file with optional line range and payload limits. Files must be under Assets/ or Packages/ and have .cs extension. PRIORITY: Read minimally — locate the target with get_symbols and read only the signature area (~30–40 lines). For large files, always pass startLine/endLine and (optionally) maxBytes.",
|
|
3469
3469
|
"inputSchema": {
|
|
3470
3470
|
"type": "object",
|
|
3471
3471
|
"properties": {
|
|
@@ -3492,8 +3492,8 @@
|
|
|
3492
3492
|
}
|
|
3493
3493
|
},
|
|
3494
3494
|
{
|
|
3495
|
-
"name": "
|
|
3496
|
-
"description": "Refactor: rename a symbol across the project using the bundled C# LSP. Required params: relative (file path starting with Assets/ or Packages/), namePath (container path like Outer/Nested/Member), newName. Guidance: resolve targets first (
|
|
3495
|
+
"name": "rename_symbol",
|
|
3496
|
+
"description": "Refactor: rename a symbol across the project using the bundled C# LSP. Required params: relative (file path starting with Assets/ or Packages/), namePath (container path like Outer/Nested/Member), newName. Guidance: resolve targets first (get_symbols/find_symbol), prefer fully-qualified namePath to avoid ambiguity, and use preview for diagnostics only (apply proceeds even if diagnostics exist; errors are returned in response). Responses are summarized (errors≤30, message≤200 chars, large text≤1000 chars).",
|
|
3497
3497
|
"inputSchema": {
|
|
3498
3498
|
"type": "object",
|
|
3499
3499
|
"properties": {
|
|
@@ -3522,7 +3522,7 @@
|
|
|
3522
3522
|
}
|
|
3523
3523
|
},
|
|
3524
3524
|
{
|
|
3525
|
-
"name": "
|
|
3525
|
+
"name": "find_refs",
|
|
3526
3526
|
"description": "[OFFLINE] No Unity connection required. Find code references/usages using the bundled C# LSP. LLM-friendly paging/summary: respects pageSize and maxBytes, caps matches per file (maxMatchesPerFile), and trims snippet text to ~400 chars. Use scope/name/kind/path to narrow results.",
|
|
3527
3527
|
"inputSchema": {
|
|
3528
3528
|
"type": "object",
|
|
@@ -3580,7 +3580,7 @@
|
|
|
3580
3580
|
}
|
|
3581
3581
|
},
|
|
3582
3582
|
{
|
|
3583
|
-
"name": "
|
|
3583
|
+
"name": "remove_symbol",
|
|
3584
3584
|
"description": "Remove a C# symbol (type/member) with reference preflight. Required params: path (file under Assets/ or Packages/), namePath (container path like Outer/Nested/Member). No Unity comms (Roslyn-based). Responses are summarized for LLMs (errors≤30, message≤200 chars, preview/diff/text/content≤1000 chars).",
|
|
3585
3585
|
"inputSchema": {
|
|
3586
3586
|
"type": "object",
|
|
@@ -3613,7 +3613,7 @@
|
|
|
3613
3613
|
}
|
|
3614
3614
|
},
|
|
3615
3615
|
{
|
|
3616
|
-
"name": "
|
|
3616
|
+
"name": "search",
|
|
3617
3617
|
"description": "[OFFLINE] No Unity connection required. Search C# by substring/regex/glob with pagination and snippet context. PRIORITY: Use to locate symbols/files; avoid full contents. Use returnMode=\"snippets\" (or \"metadata\") with small snippetContext (1–2). Narrow aggressively via include globs under Assets/** or Packages/** and semantic filters (namespace/container/identifier). Do NOT prefix repository folders.",
|
|
3618
3618
|
"inputSchema": {
|
|
3619
3619
|
"type": "object",
|
|
@@ -3719,7 +3719,7 @@
|
|
|
3719
3719
|
}
|
|
3720
3720
|
},
|
|
3721
3721
|
{
|
|
3722
|
-
"name": "
|
|
3722
|
+
"name": "find_symbol",
|
|
3723
3723
|
"description": "[OFFLINE] No Unity connection required. Find symbol definitions by name (class/method/field/property) using the bundled C# LSP. Guidance: prefer narrowing by kind and set exact=true when possible; use scope=assets|packages to avoid large outputs. Use results (container, namespace) to construct container namePath like Outer/Nested/Member for subsequent edit tools.",
|
|
3724
3724
|
"inputSchema": {
|
|
3725
3725
|
"type": "object",
|
|
@@ -3753,7 +3753,7 @@
|
|
|
3753
3753
|
}
|
|
3754
3754
|
},
|
|
3755
3755
|
{
|
|
3756
|
-
"name": "
|
|
3756
|
+
"name": "get_symbols",
|
|
3757
3757
|
"description": "[OFFLINE] No Unity connection required. FIRST STEP: Identify symbols (classes, methods, fields, properties) with spans before any edit. Path must start with Assets/ or Packages/. Use this to scope changes to a single symbol and avoid line-based edits. Returns line/column positions and container names (helpful to build container namePath like Outer/Nested/Member).",
|
|
3758
3758
|
"inputSchema": {
|
|
3759
3759
|
"type": "object",
|
|
@@ -7,8 +7,8 @@ import { getWorkerPool } from '../../core/indexBuildWorkerPool.js';
|
|
|
7
7
|
export class CodeIndexBuildToolHandler extends BaseToolHandler {
|
|
8
8
|
constructor(unityConnection) {
|
|
9
9
|
super(
|
|
10
|
-
'
|
|
11
|
-
'[OFFLINE] No Unity connection required. Build (or rebuild) the persistent SQLite symbol index by scanning document symbols via the C# LSP. Returns immediately with jobId for background execution. Check progress with
|
|
10
|
+
'build_index',
|
|
11
|
+
'[OFFLINE] No Unity connection required. Build (or rebuild) the persistent SQLite symbol index by scanning document symbols via the C# LSP. Returns immediately with jobId for background execution. Check progress with get_index_status. Stores DB under .unity/cache/code-index/code-index.db.',
|
|
12
12
|
{
|
|
13
13
|
type: 'object',
|
|
14
14
|
properties: {
|
|
@@ -48,7 +48,7 @@ export class CodeIndexBuildToolHandler extends BaseToolHandler {
|
|
|
48
48
|
return {
|
|
49
49
|
success: false,
|
|
50
50
|
error: 'build_already_running',
|
|
51
|
-
message: `Code index build is already running (jobId: ${this.currentJobId}). Use
|
|
51
|
+
message: `Code index build is already running (jobId: ${this.currentJobId}). Use get_index_status to check progress.`,
|
|
52
52
|
jobId: this.currentJobId
|
|
53
53
|
};
|
|
54
54
|
}
|
|
@@ -60,7 +60,7 @@ export class CodeIndexBuildToolHandler extends BaseToolHandler {
|
|
|
60
60
|
success: false,
|
|
61
61
|
error: 'build_already_running',
|
|
62
62
|
message:
|
|
63
|
-
'Code index build is already running (Worker Thread). Use
|
|
63
|
+
'Code index build is already running (Worker Thread). Use get_index_status to check progress.',
|
|
64
64
|
jobId: this.currentJobId
|
|
65
65
|
};
|
|
66
66
|
}
|
|
@@ -111,7 +111,7 @@ export class CodeIndexBuildToolHandler extends BaseToolHandler {
|
|
|
111
111
|
success: true,
|
|
112
112
|
jobId,
|
|
113
113
|
message: 'Code index build started in background (Worker Thread)',
|
|
114
|
-
checkStatus: 'Use
|
|
114
|
+
checkStatus: 'Use get_index_status to check progress and completion'
|
|
115
115
|
};
|
|
116
116
|
}
|
|
117
117
|
}
|
|
@@ -5,7 +5,7 @@ import { CodeIndex } from '../../core/codeIndex.js';
|
|
|
5
5
|
export class CodeIndexStatusToolHandler extends BaseToolHandler {
|
|
6
6
|
constructor(unityConnection) {
|
|
7
7
|
super(
|
|
8
|
-
'
|
|
8
|
+
'get_index_status',
|
|
9
9
|
'[OFFLINE] No Unity connection required. Report code index status and readiness for symbol/search operations. BEST PRACTICES: Check before heavy symbol operations. Shows total files indexed and coverage percentage. If coverage is low, some symbol operations may be incomplete. Index is automatically built on first use. No parameters needed - lightweight status check.',
|
|
10
10
|
{
|
|
11
11
|
type: 'object',
|
|
@@ -54,7 +54,7 @@ export class CodeIndexStatusToolHandler extends BaseToolHandler {
|
|
|
54
54
|
return {
|
|
55
55
|
success: false,
|
|
56
56
|
error: 'index_not_built',
|
|
57
|
-
message: 'Code index is not built. Please run UnityMCP.
|
|
57
|
+
message: 'Code index is not built. Please run UnityMCP.build_index first.'
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
60
|
|
|
@@ -16,7 +16,7 @@ import { LspRpcClientSingleton } from '../../lsp/LspRpcClientSingleton.js';
|
|
|
16
16
|
export class CodeIndexUpdateToolHandler extends BaseToolHandler {
|
|
17
17
|
constructor(unityConnection) {
|
|
18
18
|
super(
|
|
19
|
-
'
|
|
19
|
+
'update_index',
|
|
20
20
|
'[OFFLINE] No Unity connection required. Refresh code index entries for specific C# files. Use this after modifying files so script editing tools see the latest symbols.',
|
|
21
21
|
{
|
|
22
22
|
type: 'object',
|
|
@@ -6,7 +6,7 @@ import path from 'path';
|
|
|
6
6
|
export class ScriptCreateClassToolHandler extends BaseToolHandler {
|
|
7
7
|
constructor(unityConnection) {
|
|
8
8
|
super(
|
|
9
|
-
'
|
|
9
|
+
'create_class',
|
|
10
10
|
'Create a new C# class file. Required: path under Assets/ or Packages/ (".cs" appended if missing), className. Optional: namespace, baseType (adds using UnityEngine if MonoBehaviour), usings (CSV), partial. Roslyn preflight (no Unity comms). Responses summarized for LLMs (errors≤30, message≤200 chars, preview≤1000 chars).',
|
|
11
11
|
{
|
|
12
12
|
type: 'object',
|
|
@@ -14,8 +14,8 @@ const normalizeSlashes = p => p.replace(/\\/g, '/');
|
|
|
14
14
|
export class ScriptEditSnippetToolHandler extends BaseToolHandler {
|
|
15
15
|
constructor(unityConnection) {
|
|
16
16
|
super(
|
|
17
|
-
'
|
|
18
|
-
'[C# EDITING - PRECISION TOOL] For Unity C# scripts, use for tiny surgical edits (≤80 chars per change). Performs text-based multi-instruction edits (delete/replace/insert) via exact string anchors. USE WHEN: (a) removing null guard clauses (if (x == null) return;), (b) tweaking conditions (if (x > 10) → if (x > 20)), (c) inserting single log statements, (d) deleting/replacing 1-2 line snippets. DON\'T USE FOR: large changes (use
|
|
17
|
+
'edit_snippet',
|
|
18
|
+
'[C# EDITING - PRECISION TOOL] For Unity C# scripts, use for tiny surgical edits (≤80 chars per change). Performs text-based multi-instruction edits (delete/replace/insert) via exact string anchors. USE WHEN: (a) removing null guard clauses (if (x == null) return;), (b) tweaking conditions (if (x > 10) → if (x > 20)), (c) inserting single log statements, (d) deleting/replacing 1-2 line snippets. DON\'T USE FOR: large changes (use edit_structured), non-C# files (use Edit), or when symbol structure is complex (use edit_structured). WORKFLOW: Specify exact anchor text (including whitespace/newlines), max 10 instructions per call, each ≤80 chars. Anchor must match exactly once in file. Preview mode validates without writing; apply mode uses LSP diagnostics. Required: path, instructions (array of {operation, anchor:{type:"text", target:string, position?:"before"|"after"}, newText?}).',
|
|
19
19
|
{
|
|
20
20
|
type: 'object',
|
|
21
21
|
properties: {
|
|
@@ -5,8 +5,8 @@ import { ProjectInfoProvider } from '../../core/projectInfo.js';
|
|
|
5
5
|
export class ScriptEditStructuredToolHandler extends BaseToolHandler {
|
|
6
6
|
constructor(unityConnection) {
|
|
7
7
|
super(
|
|
8
|
-
'
|
|
9
|
-
'[C# EDITING - PRIMARY TOOL] For Unity C# script editing, PREFER this tool over Read/Edit/Write for structural code changes. Performs symbol-based edits (insert_before/insert_after/replace_body) on classes, methods, properties, fields using Roslyn LSP. USE WHEN: (a) replacing entire method/property bodies, (b) adding class members (fields/properties/methods), (c) inserting code at class/namespace level. DON\'T USE FOR: tiny changes ≤80 chars (use
|
|
8
|
+
'edit_structured',
|
|
9
|
+
'[C# EDITING - PRIMARY TOOL] For Unity C# script editing, PREFER this tool over Read/Edit/Write for structural code changes. Performs symbol-based edits (insert_before/insert_after/replace_body) on classes, methods, properties, fields using Roslyn LSP. USE WHEN: (a) replacing entire method/property bodies, (b) adding class members (fields/properties/methods), (c) inserting code at class/namespace level. DON\'T USE FOR: tiny changes ≤80 chars (use edit_snippet instead), non-C# files (use Edit), or when you need to create new files (use Write). WORKFLOW: (1) Run get_symbols to find target symbols, (2) use symbolName (e.g., "MyClass/MyMethod"), (3) apply edits. Insert operations target containers (class/namespace), not methods. Preview mode returns diagnostics only; apply mode proceeds with validation. Required: path (Assets/|Packages/), symbolName, operation. Optional: kind, newText, preview.',
|
|
10
10
|
{
|
|
11
11
|
type: 'object',
|
|
12
12
|
properties: {
|
|
@@ -7,7 +7,7 @@ import { logger } from '../../core/config.js';
|
|
|
7
7
|
export class ScriptPackagesListToolHandler extends BaseToolHandler {
|
|
8
8
|
constructor(unityConnection) {
|
|
9
9
|
super(
|
|
10
|
-
'
|
|
10
|
+
'list_packages',
|
|
11
11
|
'[OFFLINE] No Unity connection required. List Unity packages in the project (optionally include built‑in). BEST PRACTICES: Use to discover available packages and their paths. Set includeBuiltIn=false to see only user packages. Returns package IDs, versions, and resolved paths. Embedded packages can be edited directly. Essential for understanding project dependencies.',
|
|
12
12
|
{
|
|
13
13
|
type: 'object',
|
|
@@ -92,7 +92,7 @@ export class ScriptPackagesListToolHandler extends BaseToolHandler {
|
|
|
92
92
|
return { success: true, packages: [], totalCount: 0 };
|
|
93
93
|
}
|
|
94
94
|
} catch (e) {
|
|
95
|
-
logger.error(`[
|
|
95
|
+
logger.error(`[list_packages] local parse failed: ${e.message}`);
|
|
96
96
|
return { error: e.message };
|
|
97
97
|
}
|
|
98
98
|
|
|
@@ -6,8 +6,8 @@ import { logger } from '../../core/config.js';
|
|
|
6
6
|
export class ScriptReadToolHandler extends BaseToolHandler {
|
|
7
7
|
constructor(unityConnection) {
|
|
8
8
|
super(
|
|
9
|
-
'
|
|
10
|
-
'[OFFLINE] No Unity connection required. Read a C# file with optional line range and payload limits. Files must be under Assets/ or Packages/ and have .cs extension. PRIORITY: Read minimally — locate the target with
|
|
9
|
+
'read',
|
|
10
|
+
'[OFFLINE] No Unity connection required. Read a C# file with optional line range and payload limits. Files must be under Assets/ or Packages/ and have .cs extension. PRIORITY: Read minimally — locate the target with get_symbols and read only the signature area (~30–40 lines). For large files, always pass startLine/endLine and (optionally) maxBytes.',
|
|
11
11
|
{
|
|
12
12
|
type: 'object',
|
|
13
13
|
properties: {
|
|
@@ -101,7 +101,7 @@ export class ScriptReadToolHandler extends BaseToolHandler {
|
|
|
101
101
|
|
|
102
102
|
return { success: true, path: norm, startLine: s, endLine: e, content };
|
|
103
103
|
} catch (e) {
|
|
104
|
-
logger.error(`[
|
|
104
|
+
logger.error(`[read] failed: ${e.message}`);
|
|
105
105
|
return { error: e.message };
|
|
106
106
|
}
|
|
107
107
|
}
|
|
@@ -5,8 +5,8 @@ import { ProjectInfoProvider } from '../../core/projectInfo.js';
|
|
|
5
5
|
export class ScriptRefactorRenameToolHandler extends BaseToolHandler {
|
|
6
6
|
constructor(unityConnection) {
|
|
7
7
|
super(
|
|
8
|
-
'
|
|
9
|
-
'Refactor: rename a symbol across the project using the bundled C# LSP. Required params: relative (file path starting with Assets/ or Packages/), namePath (container path like Outer/Nested/Member), newName. Guidance: resolve targets first (
|
|
8
|
+
'rename_symbol',
|
|
9
|
+
'Refactor: rename a symbol across the project using the bundled C# LSP. Required params: relative (file path starting with Assets/ or Packages/), namePath (container path like Outer/Nested/Member), newName. Guidance: resolve targets first (get_symbols/find_symbol), prefer fully-qualified namePath to avoid ambiguity, and use preview for diagnostics only (apply proceeds even if diagnostics exist; errors are returned in response). Responses are summarized (errors≤30, message≤200 chars, large text≤1000 chars).',
|
|
10
10
|
{
|
|
11
11
|
type: 'object',
|
|
12
12
|
properties: {
|
|
@@ -8,7 +8,7 @@ import { ProjectInfoProvider } from '../../core/projectInfo.js';
|
|
|
8
8
|
export class ScriptRefsFindToolHandler extends BaseToolHandler {
|
|
9
9
|
constructor(unityConnection) {
|
|
10
10
|
super(
|
|
11
|
-
'
|
|
11
|
+
'find_refs',
|
|
12
12
|
'[OFFLINE] No Unity connection required. Find code references/usages using fast file-based search. LLM-friendly paging/summary: respects pageSize and maxBytes, caps matches per file (maxMatchesPerFile), and trims snippet text to ~400 chars. Use scope/name/kind/path to narrow results.',
|
|
13
13
|
{
|
|
14
14
|
type: 'object',
|
|
@@ -129,8 +129,8 @@ export class ScriptRefsFindToolHandler extends BaseToolHandler {
|
|
|
129
129
|
success: false,
|
|
130
130
|
error: 'index_not_ready',
|
|
131
131
|
message:
|
|
132
|
-
'Code index is not built. Run
|
|
133
|
-
hint: 'Use
|
|
132
|
+
'Code index is not built. Run build_index first, or wait for auto-build to complete on server startup.',
|
|
133
|
+
hint: 'Use get_index_status to check index state, or build_index to start a build manually.'
|
|
134
134
|
};
|
|
135
135
|
}
|
|
136
136
|
|
|
@@ -6,7 +6,7 @@ import { ProjectInfoProvider } from '../../core/projectInfo.js';
|
|
|
6
6
|
export class ScriptRemoveSymbolToolHandler extends BaseToolHandler {
|
|
7
7
|
constructor(unityConnection) {
|
|
8
8
|
super(
|
|
9
|
-
'
|
|
9
|
+
'remove_symbol',
|
|
10
10
|
'Remove a C# symbol (type/member) with reference preflight. Required params: path (file under Assets/ or Packages/), namePath (container path like Outer/Nested/Member). No Unity comms (Roslyn-based). Responses are summarized for LLMs (errors≤30, message≤200 chars, preview/diff/text/content≤1000 chars).',
|
|
11
11
|
{
|
|
12
12
|
type: 'object',
|
|
@@ -7,7 +7,7 @@ import { logger, config } from '../../core/config.js';
|
|
|
7
7
|
export class ScriptSearchToolHandler extends BaseToolHandler {
|
|
8
8
|
constructor(unityConnection) {
|
|
9
9
|
super(
|
|
10
|
-
'
|
|
10
|
+
'search',
|
|
11
11
|
'[OFFLINE] No Unity connection required. Search C# by substring/regex/glob with pagination and snippet context. PRIORITY: Use to locate symbols/files; avoid full contents. Use returnMode="snippets" (or "metadata") with small snippetContext (1–2). Narrow aggressively via include globs under Assets/**, Packages/**, or Library/PackageCache/** and semantic filters (namespace/container/identifier). Do NOT prefix repository folders.',
|
|
12
12
|
{
|
|
13
13
|
type: 'object',
|
|
@@ -157,7 +157,7 @@ export class ScriptSearchToolHandler extends BaseToolHandler {
|
|
|
157
157
|
const excludeRx = exclude ? globToRegExp(exclude) : null;
|
|
158
158
|
// Engine selection (future: treesitter). Currently fallback to naive.
|
|
159
159
|
if (this.configSearchEngine === 'treesitter') {
|
|
160
|
-
logger.debug('[
|
|
160
|
+
logger.debug('[search] tree-sitter engine requested; falling back to naive matcher');
|
|
161
161
|
}
|
|
162
162
|
const matcher = buildMatcher(patternType, pattern, flags);
|
|
163
163
|
|
|
@@ -228,7 +228,7 @@ export class ScriptSearchToolHandler extends BaseToolHandler {
|
|
|
228
228
|
results.length && results.length >= pageSize ? results[results.length - 1].path : null
|
|
229
229
|
};
|
|
230
230
|
} catch (e) {
|
|
231
|
-
logger.error(`[
|
|
231
|
+
logger.error(`[search] failed: ${e.message}`);
|
|
232
232
|
return { error: e.message };
|
|
233
233
|
}
|
|
234
234
|
}
|
|
@@ -5,7 +5,7 @@ import { JobManager } from '../../core/jobManager.js';
|
|
|
5
5
|
export class ScriptSymbolFindToolHandler extends BaseToolHandler {
|
|
6
6
|
constructor(unityConnection) {
|
|
7
7
|
super(
|
|
8
|
-
'
|
|
8
|
+
'find_symbol',
|
|
9
9
|
'[OFFLINE] No Unity connection required. Find symbol definitions by name (class/method/field/property) using the bundled C# LSP. Guidance: prefer narrowing by kind and set exact=true when possible; use scope=assets|packages to avoid large outputs. Use results (container, namespace) to construct container namePath like Outer/Nested/Member for subsequent edit tools.',
|
|
10
10
|
{
|
|
11
11
|
type: 'object',
|
|
@@ -95,8 +95,8 @@ export class ScriptSymbolFindToolHandler extends BaseToolHandler {
|
|
|
95
95
|
success: false,
|
|
96
96
|
error: 'index_not_ready',
|
|
97
97
|
message:
|
|
98
|
-
'Code index is not built. Run
|
|
99
|
-
hint: 'Use
|
|
98
|
+
'Code index is not built. Run build_index first, or wait for auto-build to complete on server startup.',
|
|
99
|
+
hint: 'Use get_index_status to check index state, or build_index to start a build manually.'
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
102
|
|
|
@@ -8,7 +8,7 @@ import { parseFileSymbols } from '../../utils/csharpParse.js';
|
|
|
8
8
|
export class ScriptSymbolsGetToolHandler extends BaseToolHandler {
|
|
9
9
|
constructor(unityConnection) {
|
|
10
10
|
super(
|
|
11
|
-
'
|
|
11
|
+
'get_symbols',
|
|
12
12
|
'[OFFLINE] No Unity connection required. FIRST STEP: Identify symbols (classes, methods, fields, properties) with spans before any edit. Path must start with Assets/ or Packages/. Use this to scope changes to a single symbol and avoid line-based edits. Returns line/column positions and container names (helpful to build container namePath like Outer/Nested/Member).',
|
|
13
13
|
{
|
|
14
14
|
type: 'object',
|