cwtools-shared 0.2.7 → 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.
@@ -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(): McpToolSchema[];
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;
@@ -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
- return mcpTools_1.GENERATED_MCP_TOOLS.map(entry => ({ ...entry.tool }));
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;
@@ -1,6 +1,9 @@
1
- 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_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"];
2
- export type McpToolName = typeof MCP_TOOL_NAMES[number];
3
- export declare const MCP_WRITE_TOOL_NAMES: readonly [];
4
- 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_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"];
5
- export declare function isMcpToolName(value: string): value is McpToolName;
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];
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MCP_READONLY_TOOL_NAMES = exports.MCP_WRITE_TOOL_NAMES = exports.MCP_TOOL_NAMES = void 0;
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.MCP_TOOL_NAMES = [
6
+ exports.MCP_READONLY_TOOL_NAMES = [
7
7
  'query_types',
8
8
  'query_rules',
9
9
  'query_cwt_schema',
@@ -20,6 +20,7 @@ exports.MCP_TOOL_NAMES = [
20
20
  'query_inline_instantiation',
21
21
  'analyze_pdx_flow',
22
22
  'compare_definition_with_vanilla',
23
+ 'query_targeting_weight',
23
24
  'query_localisation_index',
24
25
  'get_pdx_block',
25
26
  'get_completion_at',
@@ -40,13 +41,28 @@ exports.MCP_TOOL_NAMES = [
40
41
  'explain_shader_reachability',
41
42
  'validate_shader',
42
43
  'compare_shader_with_vanilla',
44
+ 'get_ide_context',
45
+ 'open_in_visual_editor',
43
46
  ];
44
- // The MCP surface is read-only by design: file writes go through the host agent's
45
- // own environment (Codex / Claude Code), not through this server.
46
- exports.MCP_WRITE_TOOL_NAMES = [];
47
- exports.MCP_READONLY_TOOL_NAMES = exports.MCP_TOOL_NAMES;
48
- function isMcpToolName(value) {
49
- return exports.MCP_TOOL_NAMES.includes(value);
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;
50
66
  }
51
67
  function isMcpWriteToolName(value) {
52
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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cwtools-shared",
3
- "version": "0.2.7",
3
+ "version": "0.2.9",
4
4
  "description": "Shared protocol and tool contracts for the CWTools MCP server",
5
5
  "license": "MIT",
6
6
  "repository": {