snow-flow 3.4.27 → 3.4.29

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/cli.js CHANGED
@@ -462,7 +462,7 @@ async function executeClaudeCode(prompt) {
462
462
  }
463
463
  // Launch Claude Code with MCP config and skip permissions to avoid raw mode issues
464
464
  const claudeArgs = hasMcpConfig
465
- ? ['--mcp-config', '.mcp.json', '.', '--dangerously-skip-permissions']
465
+ ? ['--mcp-config', '.mcp.json', '--dangerously-skip-permissions']
466
466
  : ['--dangerously-skip-permissions'];
467
467
  cliLogger.info('šŸš€ Launching Claude Code automatically...');
468
468
  if (hasMcpConfig) {
@@ -563,7 +563,7 @@ async function executeWithClaude(claudeCommand, prompt, resolve) {
563
563
  cliLogger.warn('āš ļø No MCP configuration found. Run "snow-flow init" to set up MCP servers');
564
564
  }
565
565
  const claudeArgs = hasMcpConfig
566
- ? ['--mcp-config', '.mcp.json', '.', '--dangerously-skip-permissions']
566
+ ? ['--mcp-config', '.mcp.json', '--dangerously-skip-permissions']
567
567
  : ['--dangerously-skip-permissions'];
568
568
  if (hasMcpConfig) {
569
569
  cliLogger.info('šŸ”§ Starting Claude Code with ServiceNow MCP servers...');
@@ -1918,10 +1918,10 @@ The MCP servers are automatically:
1918
1918
  If you need to manually activate MCP servers later:
1919
1919
  \`\`\`bash
1920
1920
  # For Mac/Linux:
1921
- claude --mcp-config .mcp.json .
1921
+ claude --mcp-config .mcp.json
1922
1922
 
1923
1923
  # For Windows:
1924
- claude.exe --mcp-config .mcp.json .
1924
+ claude.exe --mcp-config .mcp.json
1925
1925
  \`\`\`
1926
1926
 
1927
1927
  ## šŸ’” Usage Examples
@@ -89,7 +89,7 @@ class ServiceNowDevelopmentAssistantMCP {
89
89
  },
90
90
  {
91
91
  name: 'snow_get_by_sysid',
92
- description: 'Retrieves artifacts by sys_id for precise, fast lookups. More reliable than text-based searches when sys_id is known.',
92
+ description: 'Retrieves artifacts by sys_id for precise, fast lookups. Auto-detects large responses and suggests efficient field-specific queries using snow_query_table when needed. More reliable than text-based searches when sys_id is known.',
93
93
  inputSchema: {
94
94
  type: 'object',
95
95
  properties: {
@@ -2128,6 +2128,50 @@ class ServiceNowDevelopmentAssistantMCP {
2128
2128
  table: args.table,
2129
2129
  ...artifact
2130
2130
  };
2131
+ // Estimate token count (rough estimate: 1 token ā‰ˆ 4 characters)
2132
+ const jsonString = JSON.stringify(formattedArtifact, null, 2);
2133
+ const estimatedTokens = Math.ceil(jsonString.length / 4);
2134
+ const maxTokens = 25000; // MCP response limit
2135
+ let responseText;
2136
+ if (estimatedTokens > maxTokens) {
2137
+ // Response too large - return essential fields only and suggest specific field access
2138
+ const essentialFields = {
2139
+ sys_id: artifact.sys_id,
2140
+ name: artifact.name || artifact.title || 'Unknown',
2141
+ table: args.table,
2142
+ sys_updated_on: artifact.sys_updated_on,
2143
+ sys_created_on: artifact.sys_created_on,
2144
+ sys_updated_by: artifact.sys_updated_by,
2145
+ active: artifact.active,
2146
+ // Table-specific key fields
2147
+ ...(args.table === 'sp_widget' && {
2148
+ id: artifact.id,
2149
+ title: artifact.title,
2150
+ template: artifact.template ? `${artifact.template.substring(0, 200)}...` : null,
2151
+ script: artifact.script ? `${artifact.script.substring(0, 200)}...` : null,
2152
+ client_script: artifact.client_script ? `${artifact.client_script.substring(0, 200)}...` : null,
2153
+ css: artifact.css ? `${artifact.css.substring(0, 200)}...` : null
2154
+ }),
2155
+ ...(args.table === 'wf_workflow' && {
2156
+ title: artifact.title,
2157
+ workflow_version: artifact.workflow_version,
2158
+ stage: artifact.stage
2159
+ }),
2160
+ ...(args.table === 'sys_script_include' && {
2161
+ api_name: artifact.api_name,
2162
+ client_callable: artifact.client_callable,
2163
+ script: artifact.script ? `${artifact.script.substring(0, 200)}...` : null
2164
+ })
2165
+ };
2166
+ const availableFields = Object.keys(artifact).filter(key => !essentialFields.hasOwnProperty(key));
2167
+ responseText = `āœ… Found artifact by sys_id!\n\nšŸŽÆ **${formattedArtifact.name}**\nšŸ†” sys_id: ${args.sys_id}\nšŸ“Š Table: ${args.table}\n\nāš ļø **Response size limited (${estimatedTokens} tokens > ${maxTokens} limit)**\n\n**Essential Fields:**\n${JSON.stringify(essentialFields, null, 2)}\n\nšŸŽÆ **RECOMMENDATION: Get specific fields instead**\n\nUse snow_query_table with specific fields for better performance:\n\`\`\`\nsnow_query_table({\n table: "${args.table}",\n query: "sys_id=${args.sys_id}",\n fields: ["field1", "field2", "field3"], // Only fields you need\n limit: 1\n})\n\`\`\`\n\n**Available fields to choose from:**\n${availableFields.slice(0, 20).join(', ')}${availableFields.length > 20 ? `, and ${availableFields.length - 20} more...` : ''}\n\nšŸ’” **Example for ${args.table}:**\n${args.table === 'sp_widget' ? `snow_query_table({ table: "sp_widget", query: "sys_id=${args.sys_id}", fields: ["name", "title", "template", "client_script", "script"], limit: 1 })` :
2168
+ args.table === 'wf_workflow' ? `snow_query_table({ table: "wf_workflow", query: "sys_id=${args.sys_id}", fields: ["name", "title", "workflow_version", "stage"], limit: 1 })` :
2169
+ `snow_query_table({ table: "${args.table}", query: "sys_id=${args.sys_id}", fields: ["name", "sys_updated_on"], limit: 1 })`}`;
2170
+ }
2171
+ else {
2172
+ // Response size is acceptable
2173
+ responseText = `āœ… Found artifact by sys_id!\n\nšŸŽÆ **${formattedArtifact.name}**\nšŸ†” sys_id: ${args.sys_id}\nšŸ“Š Table: ${args.table}\n\n**All Fields:**\n${jsonString}`;
2174
+ }
2131
2175
  // Skip memory indexing for now - it might be causing timeouts
2132
2176
  // TODO: Investigate why memory indexing causes timeouts
2133
2177
  /*
@@ -2143,7 +2187,7 @@ class ServiceNowDevelopmentAssistantMCP {
2143
2187
  content: [
2144
2188
  {
2145
2189
  type: 'text',
2146
- text: `āœ… Found artifact by sys_id!\n\nšŸŽÆ **${formattedArtifact.name}**\nšŸ†” sys_id: ${args.sys_id}\nšŸ“Š Table: ${args.table}\n\n**All Fields:**\n${JSON.stringify(formattedArtifact, null, 2)}`,
2190
+ text: responseText,
2147
2191
  },
2148
2192
  ],
2149
2193
  };
@@ -0,0 +1,3 @@
1
+ {
2
+ "mcpServers": {}
3
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "snow-flow",
3
- "version": "3.4.27",
3
+ "version": "3.4.29",
4
4
  "description": "ServiceNow development framework with MCP server integration. Executes background scripts using ES5 JavaScript only (ServiceNow Rhino engine requirement). Provides 17 MCP servers for complete ServiceNow operations including widget deployment with coherence validation, table operations, script execution, machine learning, advanced features, and comprehensive platform management.",
5
5
  "main": "dist/index.js",
6
6
  "type": "commonjs",
@@ -0,0 +1,9 @@
1
+ {
2
+ "mcpServers": {
3
+ "filesystem": {
4
+ "command": "npx",
5
+ "args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/nielsvanderwerf/Projects"],
6
+ "description": "Filesystem access server"
7
+ }
8
+ }
9
+ }
package/test-mcp.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "mcpServers": {
3
+ "servicenow-deployment": {
4
+ "command": "node",
5
+ "args": [
6
+ "/Users/nielsvanderwerf/Projects/snow-flow-dev/snow-flow/dist/mcp/servicenow-deployment-mcp.js"
7
+ ],
8
+ "description": "Test deployment server"
9
+ }
10
+ }
11
+ }
package/test.txt ADDED
@@ -0,0 +1 @@
1
+ test file content