@ema.co/mcp-toolkit 1.4.3 → 1.5.0

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.

Potentially problematic release.


This version of @ema.co/mcp-toolkit might be problematic. Click here for more details.

@@ -140,93 +140,110 @@ export function generateConsolidatedTools(envNames, defaultEnv) {
140
140
  }),
141
141
  },
142
142
  // ═══════════════════════════════════════════════════════════════════════
143
- // 3. WORKFLOW - Generation, analysis, extension, optimization
143
+ // 3. WORKFLOW - Unified workflow operations (greenfield & brownfield)
144
144
  // ═══════════════════════════════════════════════════════════════════════
145
145
  {
146
146
  name: "workflow",
147
- description: `Unified workflow operations. All modification modes default to preview=true for safety.
147
+ description: `Unified workflow operations. Automatically detects greenfield vs brownfield.
148
148
 
149
- **Greenfield** (NEW workflow from scratch):
149
+ **Greenfield** (NEW workflow - no persona_id):
150
150
  workflow(input="IT helpdesk with KB search")
151
- workflow(mode="generate", input="customer support bot")
152
- workflow(mode="generate", input="...", preview=false) # Generate AND deploy
151
+ workflow(input="customer support bot", preview=false) # Generate AND deploy to new persona
153
152
 
154
- **Extend** (MODIFY existing workflow - brownfield):
155
- workflow(mode="extend", persona_id="abc", input="add caller_type categorizer")
156
- workflow(mode="extend", persona_id="abc", input="add HITL before email, add compliance intent")
157
- workflow(mode="extend", persona_id="abc", input="...", preview=false) # Extend AND deploy
153
+ **Brownfield** (MODIFY existing - persona_id + input):
154
+ workflow(persona_id="abc", input="add HITL before email")
155
+ workflow(persona_id="abc", input="consolidate the 6 custom agents into one unified agent")
156
+ workflow(persona_id="abc", input="remove the orphan nodes")
157
+ workflow(persona_id="abc", input="replace the email LLM nodes with entity_extraction")
158
+ workflow(persona_id="abc", input="...", preview=false) # Modify AND deploy
158
159
 
159
- **Optimize** (FIX issues in existing workflow):
160
- workflow(mode="optimize", persona_id="abc") # Preview fixes
161
- workflow(mode="optimize", persona_id="abc", preview=false) # Apply fixes
162
-
163
- **Analyze** (inspect existing - always read-only):
160
+ **Analyze** (inspect - persona_id only, no input):
164
161
  workflow(persona_id="abc-123")
165
- workflow(mode="analyze", persona_id="abc-123")
166
- workflow(mode="analyze", workflow_def={...})
162
+ workflow(persona_id="abc-123", include=["issues", "fixes"])
163
+
164
+ **Optimize** (auto-fix issues):
165
+ workflow(persona_id="abc", optimize=true)
166
+ workflow(persona_id="abc", optimize=true, preview=false) # Fix AND deploy
167
167
 
168
- **Compare** (diff two workflows - always read-only):
169
- workflow(mode="compare", persona_id="abc", compare_to="def")
168
+ **Compare**:
169
+ workflow(persona_id="abc", compare_to="def")
170
170
 
171
- **Compile** (from explicit node spec - returns workflow_def):
172
- workflow(mode="compile", name="...", description="...", nodes=[...])
171
+ **Generate extraction schema from metadata**:
172
+ workflow(mode="extraction_schema", metadata_file="/path/to/metadata.json")
173
+ workflow(mode="extraction_schema", metadata_json={...})
173
174
 
174
175
  ## Key Concepts
175
176
 
176
177
  - **preview=true** (default): Returns result without deploying. Safe for exploration.
177
- - **preview=false**: Deploys the result. Server handles fetching proto_config, etc.
178
- - **Auto-builder is abstracted**: Server decides when to use it internally.`,
178
+ - **preview=false**: Deploys the result.
179
+ - **Mode is auto-detected**: No need to specify mode - just provide what you have.
180
+ - **Complex changes supported**: Consolidate, remove, replace, rewire nodes.
181
+ - **Dynamic schema generation**: Parse JSON metadata to generate extraction schemas automatically.`,
179
182
  inputSchema: withEnv({
180
- // Mode - explicit operation
181
- mode: {
182
- type: "string",
183
- enum: ["generate", "extend", "optimize", "analyze", "compare", "compile"],
184
- description: "Operation: 'generate' (new), 'extend' (modify existing), 'optimize' (fix issues), 'analyze' (inspect), 'compare' (diff), 'compile' (from nodes). Default: inferred from args."
185
- },
186
- // Input (for generate/extend)
183
+ // Input - natural language description of what you want
187
184
  input: {
188
185
  anyOf: [
189
186
  { type: "string", description: "Natural language description" },
190
187
  { type: "object", description: "Workflow intent/spec object" },
191
188
  ],
192
- description: "Natural language requirements. Can include multiple changes: 'add X, add Y, add Z'",
189
+ description: "What you want: 'IT helpdesk bot' (greenfield) or 'consolidate agents into one' (brownfield with persona_id)",
193
190
  },
194
- // Target persona (for extend/optimize/analyze/compare)
191
+ // Target persona (if provided = brownfield, if not = greenfield)
195
192
  persona_id: {
196
193
  type: "string",
197
- description: "Persona ID for existing workflow operations (extend/optimize/analyze/compare)"
194
+ description: "Existing persona to modify. If provided with input = brownfield modification."
198
195
  },
199
196
  // Preview vs Deploy (default: preview=true for safety)
200
197
  preview: {
201
198
  type: "boolean",
202
199
  description: "Preview changes without deploying. Default: true. Set false to deploy."
203
200
  },
204
- // Persona type (for generate)
205
- type: {
206
- type: "string",
207
- enum: ["voice", "chat", "dashboard"],
208
- description: "Persona type for generate mode (default: chat)"
201
+ // Optimize flag - auto-fix detected issues
202
+ optimize: {
203
+ type: "boolean",
204
+ description: "Auto-fix detected issues in the workflow. Use with persona_id.",
209
205
  },
210
206
  // Compare target
211
- compare_to: { type: "string", description: "Second persona ID for compare mode" },
207
+ compare_to: { type: "string", description: "Second persona ID for comparison" },
212
208
  // Analyze options
213
209
  include: {
214
210
  type: "array",
215
211
  items: { type: "string", enum: ["issues", "connections", "fixes", "metrics"] },
216
212
  description: "What to include in analysis. Default: all.",
217
213
  },
218
- // Direct workflow input (for analyze without persona_id)
214
+ // Persona type (for greenfield)
215
+ type: {
216
+ type: "string",
217
+ enum: ["voice", "chat", "dashboard"],
218
+ description: "Persona type for new workflows (default: chat)"
219
+ },
220
+ // Direct workflow input (for analysis)
219
221
  workflow_def: {
220
222
  type: "object",
221
223
  description: "Workflow JSON for analysis (alternative to persona_id)"
222
224
  },
223
- // Compile mode inputs
225
+ // Proto config override
226
+ proto_config: { type: "object", description: "Persona config override (voice settings, etc.)" },
227
+ // Legacy mode support (for backwards compatibility)
228
+ mode: {
229
+ type: "string",
230
+ enum: ["generate", "extend", "optimize", "analyze", "compare", "compile", "extraction_schema"],
231
+ description: "DEPRECATED: Mode is auto-detected. Use explicitly for compile or extraction_schema mode."
232
+ },
233
+ // Extraction schema generation (dynamic, no hardcoding)
234
+ metadata_file: {
235
+ type: "string",
236
+ description: "Path to JSON metadata file for extraction schema generation"
237
+ },
238
+ metadata_json: {
239
+ type: "object",
240
+ description: "JSON metadata object (alternative to metadata_file) - dynamically parsed to generate extraction fields"
241
+ },
242
+ // Compile mode inputs (explicit node spec)
224
243
  name: { type: "string", description: "Workflow name (for compile mode)" },
225
244
  description: { type: "string", description: "Workflow description (for compile mode)" },
226
245
  nodes: { type: "array", description: "Node definitions (for compile mode)" },
227
246
  result_mappings: { type: "array", description: "Output mappings (for compile mode)" },
228
- // Proto config override
229
- proto_config: { type: "object", description: "Persona config override (voice settings, etc.)" },
230
247
  }),
231
248
  },
232
249
  // ═══════════════════════════════════════════════════════════════════════
@@ -406,6 +423,20 @@ export function generateConsolidatedTools(envNames, defaultEnv) {
406
423
  **Guidance**:
407
424
  reference(guidance="categorizer-routing")
408
425
  reference(guidance="type-compatibility")
426
+ reference(guidance="workflow-structure") # Summarizer → Extractor → JSON mapper pattern
427
+ reference(guidance="search-node-timing") # When to use search nodes, early vs late
428
+ reference(guidance="node-execution-conditions") # When nodes execute or are skipped
429
+ reference(guidance="array-preservation") # How to preserve arrays through extraction → mapping → downstream
430
+ reference(guidance="search-filtering") # Semantic query + structured filters best practices
431
+ reference(guidance="fallback-response-inputs") # Fallback should use full conversation + context
432
+ reference(guidance="separate-vs-merged-inputs") # Keep separate named_inputs for multi-source data
433
+ reference(guidance="folder-path-filtering") # Folder path filtering with semantic query
434
+ reference(guidance="automated-extraction-json") # Automating extraction → JSON mapper pattern
435
+ reference(guidance="when-filters-necessary") # When filters are required vs optional
436
+ reference(guidance="filter-query-guidance") # When to use filters vs queries vs both
437
+ reference(guidance="workflow-structure")
438
+ reference(guidance="search-node-timing")
439
+ reference(guidance="node-execution-conditions")
409
440
 
410
441
  **Debugging**:
411
442
  reference(mistakes=true)
package/dist/sdk/index.js CHANGED
@@ -45,3 +45,7 @@ hashSnapshot, generateVersionId, generateVersionName, nowIso, createSnapshotFrom
45
45
  export { VersionStorage, createVersionStorage, } from "./version-storage.js";
46
46
  // Version Policy Engine (Automatic versioning decisions)
47
47
  export { VersionPolicyEngine, createVersionPolicyEngine, } from "./version-policy.js";
48
+ // Workflow Execution Analyzer (Loop, multiple responder, redundant classifier detection)
49
+ export { analyzeExecutionFlow, detectLoops, detectMultipleResponders, detectRedundantClassifiers, analyzeDataFlow, findDeadCodePaths, generateASCIIFlow, } from "./workflow-execution-analyzer.js";
50
+ // Workflow Fixer (Auto-fix including multiple responder issues)
51
+ export { autoFixWorkflow, suggestFixes, } from "./workflow-fixer.js";