cwtools-shared 0.2.8 → 0.2.9
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/dist/generated/mcpTools.d.ts +2095 -0
- package/dist/generated/mcpTools.js +2793 -0
- package/dist/tools/mcpSchema.d.ts +3 -1
- package/dist/tools/mcpSchema.js +6 -2
- package/dist/tools/names.d.ts +8 -5
- package/dist/tools/names.js +23 -8
- package/dist/tools/toolHandlers.js +9 -0
- package/package.json +1 -1
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { GeneratedMcpTool, McpToolSchema } from './schema';
|
|
2
2
|
export declare function getGeneratedMcpTools(): readonly GeneratedMcpTool[];
|
|
3
|
-
export declare function listMcpToolSchemas(
|
|
3
|
+
export declare function listMcpToolSchemas(options?: {
|
|
4
|
+
includeWrites?: boolean;
|
|
5
|
+
}): McpToolSchema[];
|
|
4
6
|
export declare function getMcpToolSchema(name: string): McpToolSchema | undefined;
|
|
5
7
|
export declare function getMcpToolRegistryMetadata(name: string): GeneratedMcpTool['registry'] | undefined;
|
package/dist/tools/mcpSchema.js
CHANGED
|
@@ -5,11 +5,15 @@ exports.listMcpToolSchemas = listMcpToolSchemas;
|
|
|
5
5
|
exports.getMcpToolSchema = getMcpToolSchema;
|
|
6
6
|
exports.getMcpToolRegistryMetadata = getMcpToolRegistryMetadata;
|
|
7
7
|
const mcpTools_1 = require("../generated/mcpTools");
|
|
8
|
+
const names_1 = require("./names");
|
|
8
9
|
function getGeneratedMcpTools() {
|
|
9
10
|
return mcpTools_1.GENERATED_MCP_TOOLS;
|
|
10
11
|
}
|
|
11
|
-
function listMcpToolSchemas() {
|
|
12
|
-
|
|
12
|
+
function listMcpToolSchemas(options) {
|
|
13
|
+
const includeWrites = options?.includeWrites === true;
|
|
14
|
+
return mcpTools_1.GENERATED_MCP_TOOLS
|
|
15
|
+
.filter(entry => includeWrites || !(0, names_1.isMcpWriteToolName)(entry.tool.name))
|
|
16
|
+
.map(entry => ({ ...entry.tool }));
|
|
13
17
|
}
|
|
14
18
|
function getMcpToolSchema(name) {
|
|
15
19
|
return mcpTools_1.GENERATED_MCP_TOOLS.find(entry => entry.tool.name === name)?.tool;
|
package/dist/tools/names.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
export
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
5
|
-
export
|
|
1
|
+
export declare const MCP_READONLY_TOOL_NAMES: readonly ["query_types", "query_rules", "query_cwt_schema", "search_rule_capabilities", "explain_scope", "parse_pdx_fragment", "query_scope", "get_diagnostics", "analyze_diagnostic_error", "query_project_profile", "query_project_knowledge", "query_workspace_index", "explore_pdx_project", "query_inline_instantiation", "analyze_pdx_flow", "compare_definition_with_vanilla", "query_targeting_weight", "query_localisation_index", "get_pdx_block", "get_completion_at", "document_symbols", "workspace_symbols", "go_to_definition", "find_references", "query_scripted_effects", "query_scripted_triggers", "query_enums", "query_static_modifiers", "query_variables", "get_entity_info", "query_shader_symbol", "query_shader_compile_unit", "query_shader_platform_variants", "query_shader_callers", "explain_shader_reachability", "validate_shader", "compare_shader_with_vanilla", "get_ide_context", "open_in_visual_editor"];
|
|
2
|
+
export declare const MCP_WRITE_TOOL_NAMES: readonly ["write_localisation", "typed_pdx_write", "candidate_transaction", "convert_image_to_dds", "convert_audio", "deploy_mod_asset"];
|
|
3
|
+
export declare const MCP_TOOL_NAMES: readonly ["query_types", "query_rules", "query_cwt_schema", "search_rule_capabilities", "explain_scope", "parse_pdx_fragment", "query_scope", "get_diagnostics", "analyze_diagnostic_error", "query_project_profile", "query_project_knowledge", "query_workspace_index", "explore_pdx_project", "query_inline_instantiation", "analyze_pdx_flow", "compare_definition_with_vanilla", "query_targeting_weight", "query_localisation_index", "get_pdx_block", "get_completion_at", "document_symbols", "workspace_symbols", "go_to_definition", "find_references", "query_scripted_effects", "query_scripted_triggers", "query_enums", "query_static_modifiers", "query_variables", "get_entity_info", "query_shader_symbol", "query_shader_compile_unit", "query_shader_platform_variants", "query_shader_callers", "explain_shader_reachability", "validate_shader", "compare_shader_with_vanilla", "get_ide_context", "open_in_visual_editor"];
|
|
4
|
+
export declare const MCP_ALL_TOOL_NAMES: readonly ["query_types", "query_rules", "query_cwt_schema", "search_rule_capabilities", "explain_scope", "parse_pdx_fragment", "query_scope", "get_diagnostics", "analyze_diagnostic_error", "query_project_profile", "query_project_knowledge", "query_workspace_index", "explore_pdx_project", "query_inline_instantiation", "analyze_pdx_flow", "compare_definition_with_vanilla", "query_targeting_weight", "query_localisation_index", "get_pdx_block", "get_completion_at", "document_symbols", "workspace_symbols", "go_to_definition", "find_references", "query_scripted_effects", "query_scripted_triggers", "query_enums", "query_static_modifiers", "query_variables", "get_entity_info", "query_shader_symbol", "query_shader_compile_unit", "query_shader_platform_variants", "query_shader_callers", "explain_shader_reachability", "validate_shader", "compare_shader_with_vanilla", "get_ide_context", "open_in_visual_editor", "write_localisation", "typed_pdx_write", "candidate_transaction", "convert_image_to_dds", "convert_audio", "deploy_mod_asset"];
|
|
5
|
+
export type McpToolName = typeof MCP_ALL_TOOL_NAMES[number];
|
|
6
|
+
export declare function isMcpToolName(value: string, options?: {
|
|
7
|
+
includeWrites?: boolean;
|
|
8
|
+
}): value is McpToolName;
|
|
6
9
|
export declare function isMcpWriteToolName(value: string): value is typeof MCP_WRITE_TOOL_NAMES[number];
|
package/dist/tools/names.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.MCP_ALL_TOOL_NAMES = exports.MCP_TOOL_NAMES = exports.MCP_WRITE_TOOL_NAMES = exports.MCP_READONLY_TOOL_NAMES = void 0;
|
|
4
4
|
exports.isMcpToolName = isMcpToolName;
|
|
5
5
|
exports.isMcpWriteToolName = isMcpWriteToolName;
|
|
6
|
-
exports.
|
|
6
|
+
exports.MCP_READONLY_TOOL_NAMES = [
|
|
7
7
|
'query_types',
|
|
8
8
|
'query_rules',
|
|
9
9
|
'query_cwt_schema',
|
|
@@ -41,13 +41,28 @@ exports.MCP_TOOL_NAMES = [
|
|
|
41
41
|
'explain_shader_reachability',
|
|
42
42
|
'validate_shader',
|
|
43
43
|
'compare_shader_with_vanilla',
|
|
44
|
+
'get_ide_context',
|
|
45
|
+
'open_in_visual_editor',
|
|
44
46
|
];
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
exports.MCP_WRITE_TOOL_NAMES = [
|
|
48
|
+
'write_localisation',
|
|
49
|
+
'typed_pdx_write',
|
|
50
|
+
'candidate_transaction',
|
|
51
|
+
'convert_image_to_dds',
|
|
52
|
+
'convert_audio',
|
|
53
|
+
'deploy_mod_asset',
|
|
54
|
+
];
|
|
55
|
+
exports.MCP_TOOL_NAMES = exports.MCP_READONLY_TOOL_NAMES;
|
|
56
|
+
exports.MCP_ALL_TOOL_NAMES = [
|
|
57
|
+
...exports.MCP_READONLY_TOOL_NAMES,
|
|
58
|
+
...exports.MCP_WRITE_TOOL_NAMES,
|
|
59
|
+
];
|
|
60
|
+
function isMcpToolName(value, options) {
|
|
61
|
+
if (exports.MCP_READONLY_TOOL_NAMES.includes(value))
|
|
62
|
+
return true;
|
|
63
|
+
if (options?.includeWrites && exports.MCP_WRITE_TOOL_NAMES.includes(value))
|
|
64
|
+
return true;
|
|
65
|
+
return false;
|
|
51
66
|
}
|
|
52
67
|
function isMcpWriteToolName(value) {
|
|
53
68
|
return exports.MCP_WRITE_TOOL_NAMES.includes(value);
|
|
@@ -328,6 +328,15 @@ const defaultSharedToolDispatcher = async (host, name, rawArgs) => {
|
|
|
328
328
|
return executeLspTool(host, 'cwtools.ai.shader.compareVanilla', [typeof args.effectName === 'string' && args.effectName
|
|
329
329
|
? { effectName: args.effectName }
|
|
330
330
|
: { uri: toFileUri(String(args.file ?? ''), host.workspaceRoot) }], 'Start the CWTools LSP process and wait for the shader model to load before comparing with vanilla.');
|
|
331
|
+
case 'get_ide_context':
|
|
332
|
+
case 'open_in_visual_editor':
|
|
333
|
+
return (0, schema_1.toolUnavailable)(name, `${name} requires the active VS Code extension bridge (default mode without --standalone).`, ['Open the project in VS Code / Cursor / Antigravity with the CWTools extension active and connect via bridge mode.']);
|
|
334
|
+
case 'typed_pdx_write':
|
|
335
|
+
case 'candidate_transaction':
|
|
336
|
+
case 'convert_image_to_dds':
|
|
337
|
+
case 'convert_audio':
|
|
338
|
+
case 'deploy_mod_asset':
|
|
339
|
+
return (0, schema_1.toolUnavailable)(name, `${name} requires the active VS Code extension bridge started with --allow-domain-writes (or --enable-writes).`, ['Connect to the active VS Code extension bridge with --allow-domain-writes enabled.']);
|
|
331
340
|
default:
|
|
332
341
|
return {
|
|
333
342
|
ok: false,
|