@ema.co/mcp-toolkit 0.2.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.
- package/LICENSE +21 -0
- package/README.md +321 -0
- package/config.example.yaml +32 -0
- package/dist/cli/index.js +333 -0
- package/dist/config.js +136 -0
- package/dist/emaClient.js +398 -0
- package/dist/index.js +109 -0
- package/dist/mcp/handlers-consolidated.js +851 -0
- package/dist/mcp/index.js +15 -0
- package/dist/mcp/prompts.js +1753 -0
- package/dist/mcp/resources.js +624 -0
- package/dist/mcp/server.js +4723 -0
- package/dist/mcp/tools-consolidated.js +590 -0
- package/dist/mcp/tools-legacy.js +736 -0
- package/dist/models.js +8 -0
- package/dist/scheduler.js +21 -0
- package/dist/sdk/client.js +788 -0
- package/dist/sdk/config.js +136 -0
- package/dist/sdk/contracts.js +429 -0
- package/dist/sdk/generation-schema.js +189 -0
- package/dist/sdk/index.js +39 -0
- package/dist/sdk/knowledge.js +2780 -0
- package/dist/sdk/models.js +8 -0
- package/dist/sdk/state.js +88 -0
- package/dist/sdk/sync-options.js +216 -0
- package/dist/sdk/sync.js +220 -0
- package/dist/sdk/validation-rules.js +355 -0
- package/dist/sdk/workflow-generator.js +291 -0
- package/dist/sdk/workflow-intent.js +1585 -0
- package/dist/state.js +88 -0
- package/dist/sync.js +416 -0
- package/dist/syncOptions.js +216 -0
- package/dist/ui.js +334 -0
- package/docs/advisor-comms-assistant-fixes.md +175 -0
- package/docs/api-contracts.md +216 -0
- package/docs/auto-builder-analysis.md +271 -0
- package/docs/data-architecture.md +166 -0
- package/docs/ema-auto-builder-guide.html +394 -0
- package/docs/ema-user-guide.md +1121 -0
- package/docs/mcp-tools-guide.md +149 -0
- package/docs/naming-conventions.md +218 -0
- package/docs/tool-consolidation-proposal.md +427 -0
- package/package.json +98 -0
- package/resources/templates/chat-ai/README.md +119 -0
- package/resources/templates/chat-ai/persona-config.json +111 -0
- package/resources/templates/dashboard-ai/README.md +156 -0
- package/resources/templates/dashboard-ai/persona-config.json +180 -0
- package/resources/templates/voice-ai/README.md +123 -0
- package/resources/templates/voice-ai/persona-config.json +74 -0
- package/resources/templates/voice-ai/workflow-prompt.md +120 -0
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# Data Architecture & Sourcing Strategy
|
|
2
|
+
|
|
3
|
+
> **Principle**: MCP serves all data. Cursor rules are policy/flow only.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Data Sourcing Hierarchy
|
|
8
|
+
|
|
9
|
+
For any data that MCP exposes, follow this resolution order:
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
1. Ema API (live, authoritative) ← PREFERRED
|
|
13
|
+
2. resources/** (repo files) ← FILE FALLBACK
|
|
14
|
+
3. src/sdk/*.ts (embedded constants) ← CODE FALLBACK
|
|
15
|
+
4. NEVER: .cursor/rules/** ← POLICY ONLY, NO DATA
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Current State Audit
|
|
21
|
+
|
|
22
|
+
### ✅ DYNAMIC (API-First)
|
|
23
|
+
|
|
24
|
+
| Resource | Source | Fallback | Notes |
|
|
25
|
+
|----------|--------|----------|-------|
|
|
26
|
+
| `ema://catalog/agents` | `listActions()` API | `AGENT_CATALOG` | Cached 60s, env-aware |
|
|
27
|
+
| `ema://catalog/agents-summary` | `listActions()` API | `AGENT_CATALOG` | Markdown format |
|
|
28
|
+
| `ema://catalog/templates` | `getPersonaTemplates()` API | Empty (use file-backed) | Cached 60s, env-aware |
|
|
29
|
+
| `ema://catalog/templates-summary` | `getPersonaTemplates()` API | Empty | Markdown format |
|
|
30
|
+
| `action(...)` tool | `listActions()` API | Embedded docs | Full API integration |
|
|
31
|
+
|
|
32
|
+
### ⚠️ HARDCODED (Embedded in Code)
|
|
33
|
+
|
|
34
|
+
| Resource | Source | Can Be Dynamic? | Priority |
|
|
35
|
+
|----------|--------|-----------------|----------|
|
|
36
|
+
| `ema://catalog/patterns` | `WORKFLOW_PATTERNS` | Yes - could query "template personas" | Medium |
|
|
37
|
+
| `ema://catalog/widgets` | `WIDGET_CATALOG` | Yes - could query API | Low |
|
|
38
|
+
| `ema://rules/input-sources` | `INPUT_SOURCE_RULES` | Unlikely - validation logic | Low |
|
|
39
|
+
| `ema://rules/anti-patterns` | `ANTI_PATTERNS` | Unlikely - validation logic | Low |
|
|
40
|
+
| `ema://rules/optimizations` | `OPTIMIZATION_RULES` | Unlikely - validation logic | Low |
|
|
41
|
+
|
|
42
|
+
### 📁 FILE-BACKED (Repo Files - Fallback)
|
|
43
|
+
|
|
44
|
+
| Resource | Path | Notes |
|
|
45
|
+
|----------|------|-------|
|
|
46
|
+
| `ema://templates/voice-ai/*` | `resources/templates/voice-ai/` | Fallback when API unavailable |
|
|
47
|
+
| `ema://templates/chat-ai/*` | `resources/templates/chat-ai/` | Fallback when API unavailable |
|
|
48
|
+
| `ema://templates/dashboard-ai/*` | `resources/templates/dashboard-ai/` | Fallback when API unavailable |
|
|
49
|
+
| `ema://docs/*` | `docs/*.md` | Repo documentation |
|
|
50
|
+
|
|
51
|
+
**Note**: For templates, prefer `ema://catalog/templates` (API-first) over file-backed `ema://templates/*`.
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Making More Things Dynamic
|
|
56
|
+
|
|
57
|
+
### ✅ DONE: Templates
|
|
58
|
+
|
|
59
|
+
Templates are now API-first via `getPersonaTemplates()`:
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
// EmaClient method
|
|
63
|
+
async getPersonaTemplates(): Promise<PersonaTemplateDTO[]>
|
|
64
|
+
|
|
65
|
+
// MCP Resources (API-first with cache)
|
|
66
|
+
ema://catalog/templates // Full template data
|
|
67
|
+
ema://catalog/templates-summary // Markdown summary
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Medium Priority: Workflow Patterns
|
|
71
|
+
|
|
72
|
+
Patterns could be derived from analyzing existing personas:
|
|
73
|
+
|
|
74
|
+
```typescript
|
|
75
|
+
// Future: Pattern extraction from existing personas
|
|
76
|
+
async function getPatterns() {
|
|
77
|
+
// 1. Query personas tagged as "template" or "pattern"
|
|
78
|
+
const templatePersonas = await client.getPersonasWithTag("template");
|
|
79
|
+
if (templatePersonas.length > 0) {
|
|
80
|
+
return extractPatternsFromPersonas(templatePersonas);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// 2. Fallback to embedded patterns
|
|
84
|
+
return WORKFLOW_PATTERNS;
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Low Priority: Validation Rules
|
|
89
|
+
|
|
90
|
+
These are internal logic, not external data. Keep embedded unless Ema provides a validation API.
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## Where Data Lives
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
ema-mcp-toolkit/
|
|
98
|
+
├── src/
|
|
99
|
+
│ ├── mcp/
|
|
100
|
+
│ │ ├── resources.ts # Resource registry + dynamic fetching
|
|
101
|
+
│ │ ├── server.ts # Tool handlers (API calls)
|
|
102
|
+
│ │ └── prompts.ts # Prompt definitions (structured guidance)
|
|
103
|
+
│ └── sdk/
|
|
104
|
+
│ ├── client.ts # EmaClient (API wrapper)
|
|
105
|
+
│ ├── knowledge.ts # AGENT_CATALOG, WORKFLOW_PATTERNS, WIDGET_CATALOG
|
|
106
|
+
│ └── validation-rules.ts # INPUT_SOURCE_RULES, ANTI_PATTERNS, OPTIMIZATION_RULES
|
|
107
|
+
├── resources/
|
|
108
|
+
│ └── templates/ # File-backed templates (canonical location)
|
|
109
|
+
│ ├── voice-ai/
|
|
110
|
+
│ ├── chat-ai/
|
|
111
|
+
│ └── dashboard-ai/
|
|
112
|
+
└── .cursor/
|
|
113
|
+
└── rules/ # POLICY/FLOW ONLY - NO DATA
|
|
114
|
+
├── base/naming/ # Naming conventions
|
|
115
|
+
├── ema/ # MCP usage guidance
|
|
116
|
+
└── platforms/ema/ # Platform-specific flows
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## Cursor Rules Policy
|
|
122
|
+
|
|
123
|
+
### ✅ ALLOWED in Cursor Rules
|
|
124
|
+
|
|
125
|
+
- **Process flows**: "How to create an AI Employee"
|
|
126
|
+
- **Decision trees**: "When to use HITL"
|
|
127
|
+
- **Tool usage guidance**: "Use `workflow(mode='analyze')` for..."
|
|
128
|
+
- **References to MCP**: "Fetch from `ema://catalog/agents`"
|
|
129
|
+
- **Best practices**: "Always extract email recipients via entity_extraction"
|
|
130
|
+
|
|
131
|
+
### ❌ NOT ALLOWED in Cursor Rules
|
|
132
|
+
|
|
133
|
+
- **Agent definitions**: Use `ema://catalog/agents`
|
|
134
|
+
- **Template content**: Use `ema://templates/*`
|
|
135
|
+
- **Validation rules data**: Use `ema://rules/*`
|
|
136
|
+
- **Hardcoded patterns**: Use `ema://catalog/patterns`
|
|
137
|
+
- **Any data that can change**: Must come from MCP
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## Implementation Checklist
|
|
142
|
+
|
|
143
|
+
### Already Done ✅
|
|
144
|
+
|
|
145
|
+
- [x] Agent catalog is API-first (`getDynamicAgentCatalog()`)
|
|
146
|
+
- [x] Templates moved from `.cursor/` to `resources/`
|
|
147
|
+
- [x] `action(...)` tool uses API with docs fallback
|
|
148
|
+
- [x] Resources support `?env=` parameter
|
|
149
|
+
- [x] **Persona templates are API-first** (`getDynamicPersonaTemplates()`)
|
|
150
|
+
- [x] Added `EmaClient.getPersonaTemplates()` method
|
|
151
|
+
- [x] Added `ema://catalog/templates` and `ema://catalog/templates-summary` resources
|
|
152
|
+
|
|
153
|
+
### To Do (Future)
|
|
154
|
+
|
|
155
|
+
- [ ] Extract workflow patterns from template `workflow_definition` fields
|
|
156
|
+
- [ ] Consider caching strategy improvements (longer TTL for stable data)
|
|
157
|
+
- [ ] Add health check for API availability
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## Related Documentation
|
|
162
|
+
|
|
163
|
+
- `docs/mcp-tools-guide.md` - Tool usage
|
|
164
|
+
- `docs/naming-conventions.md` - Naming standards
|
|
165
|
+
- `.cursor/rules/base/naming/RULE.md` - Naming enforcement
|
|
166
|
+
- `.cursor/rules/ema/RULE.md` - MCP source-of-truth policy
|
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<title>Ema Auto Builder Quick Reference</title>
|
|
6
|
+
<style>
|
|
7
|
+
body {
|
|
8
|
+
font-family: 'Google Sans', Arial, sans-serif;
|
|
9
|
+
max-width: 900px;
|
|
10
|
+
margin: 0 auto;
|
|
11
|
+
padding: 40px 20px;
|
|
12
|
+
line-height: 1.6;
|
|
13
|
+
color: #202124;
|
|
14
|
+
}
|
|
15
|
+
h1 { color: #1a73e8; border-bottom: 3px solid #1a73e8; padding-bottom: 10px; }
|
|
16
|
+
h2 { color: #185abc; margin-top: 40px; border-bottom: 1px solid #dadce0; padding-bottom: 8px; }
|
|
17
|
+
h3 { color: #1967d2; margin-top: 25px; }
|
|
18
|
+
h4 { color: #5f6368; }
|
|
19
|
+
table { border-collapse: collapse; width: 100%; margin: 15px 0; }
|
|
20
|
+
th, td { border: 1px solid #dadce0; padding: 10px 12px; text-align: left; }
|
|
21
|
+
th { background: #f8f9fa; font-weight: 600; color: #202124; }
|
|
22
|
+
tr:nth-child(even) { background: #fafafa; }
|
|
23
|
+
code { background: #f1f3f4; padding: 2px 6px; border-radius: 4px; font-family: 'Roboto Mono', monospace; font-size: 0.9em; color: #d93025; }
|
|
24
|
+
pre { background: #f8f9fa; padding: 16px; border-radius: 8px; overflow-x: auto; border: 1px solid #dadce0; }
|
|
25
|
+
pre code { background: none; color: #202124; }
|
|
26
|
+
blockquote { border-left: 4px solid #1a73e8; margin: 20px 0; padding: 10px 20px; background: #e8f0fe; color: #174ea6; }
|
|
27
|
+
.callout { background: #fef7e0; border-left: 4px solid #f9ab00; padding: 12px 16px; margin: 15px 0; }
|
|
28
|
+
.callout-info { background: #e8f0fe; border-left-color: #1a73e8; }
|
|
29
|
+
.callout-success { background: #e6f4ea; border-left-color: #34a853; }
|
|
30
|
+
.callout-warning { background: #fef7e0; border-left-color: #f9ab00; }
|
|
31
|
+
.callout-error { background: #fce8e6; border-left-color: #ea4335; }
|
|
32
|
+
ul, ol { margin: 10px 0; padding-left: 25px; }
|
|
33
|
+
li { margin: 5px 0; }
|
|
34
|
+
.emoji { font-size: 1.2em; }
|
|
35
|
+
.tag { display: inline-block; background: #e8f0fe; color: #1967d2; padding: 2px 8px; border-radius: 4px; font-size: 0.85em; margin: 2px; }
|
|
36
|
+
.tag-required { background: #fce8e6; color: #c5221f; }
|
|
37
|
+
hr { border: none; border-top: 1px solid #dadce0; margin: 30px 0; }
|
|
38
|
+
</style>
|
|
39
|
+
</head>
|
|
40
|
+
<body>
|
|
41
|
+
|
|
42
|
+
<h1>🚀 Ema Auto Builder Quick Reference</h1>
|
|
43
|
+
<p><strong>Ema AI Employee Builder (GWE)</strong>: Quick reference for natural language prompts — triggers, inputs, logic, outputs</p>
|
|
44
|
+
|
|
45
|
+
<hr>
|
|
46
|
+
|
|
47
|
+
<h2>🔧 MCP Tools: Use Ema MCP for Live Data</h2>
|
|
48
|
+
|
|
49
|
+
<p><strong>Ema MCP Server provides real-time platform intelligence.</strong> Always leverage MCP tools.</p>
|
|
50
|
+
|
|
51
|
+
<div class="callout callout-info">
|
|
52
|
+
<strong>Tool names in Cursor:</strong> MCP server defines base tool names like <code>persona</code>, <code>workflow</code>, <code>action</code>. In <strong>Cursor</strong>, tools are prefixed with <code>mcp_ema_</code> (e.g., <code>mcp_ema_persona</code>).
|
|
53
|
+
</div>
|
|
54
|
+
|
|
55
|
+
<table>
|
|
56
|
+
<tr><th>MCP Tool</th><th>When to Use</th></tr>
|
|
57
|
+
<tr><td><code>mcp_ema_template(questions=true)</code></td><td><strong>FIRST</strong> — Get structured questions before asking user</td></tr>
|
|
58
|
+
<tr><td><code>mcp_ema_action(suggest="...")</code></td><td>Match use case to recommended agents/patterns</td></tr>
|
|
59
|
+
<tr><td><code>mcp_ema_template(pattern="...")</code></td><td>Get template with nodes, connections, anti-patterns</td></tr>
|
|
60
|
+
<tr><td><code>mcp_ema_action(id="...", include_docs=true)</code></td><td>Get agent inputs/outputs + docs + critical rules</td></tr>
|
|
61
|
+
<tr><td><code>mcp_ema_reference(validate_prompt="...")</code></td><td><strong>LAST</strong> — Validate before outputting</td></tr>
|
|
62
|
+
<tr><td><code>mcp_ema_reference(mistakes=true)</code></td><td>Check against top errors before finalizing</td></tr>
|
|
63
|
+
</table>
|
|
64
|
+
|
|
65
|
+
<h3>MCP-First Generation Flow</h3>
|
|
66
|
+
<pre><code>1. mcp_ema_template(questions=true) → Structure user questions
|
|
67
|
+
2. mcp_ema_action(suggest="...") → Get recommended pattern
|
|
68
|
+
3. mcp_ema_template(pattern="...") → Get template
|
|
69
|
+
4. mcp_ema_action(id="...", include_docs=true) → Get each agent's details
|
|
70
|
+
5. mcp_ema_reference(validate_prompt="...") → Validate before output</code></pre>
|
|
71
|
+
|
|
72
|
+
<h3>Key MCP Tools by Category</h3>
|
|
73
|
+
<table>
|
|
74
|
+
<tr><th>Category</th><th>Tools</th></tr>
|
|
75
|
+
<tr><td><strong>Discovery</strong></td><td><code>persona</code>, <code>env</code></td></tr>
|
|
76
|
+
<tr><td><strong>Agents</strong></td><td><code>action</code></td></tr>
|
|
77
|
+
<tr><td><strong>Patterns</strong></td><td><code>template</code></td></tr>
|
|
78
|
+
<tr><td><strong>Validation</strong></td><td><code>reference(validate_prompt=...)</code>, <code>reference(check_types={...})</code></td></tr>
|
|
79
|
+
<tr><td><strong>Guidance</strong></td><td><code>reference</code></td></tr>
|
|
80
|
+
<tr><td><strong>Sync</strong></td><td><code>sync</code>, <code>persona(mode="compare")</code></td></tr>
|
|
81
|
+
<tr><td><strong>Review</strong></td><td><code>workflow(mode="analyze")</code>, <code>workflow(mode="optimize")</code></td></tr>
|
|
82
|
+
</table>
|
|
83
|
+
|
|
84
|
+
<hr>
|
|
85
|
+
|
|
86
|
+
<h2>⚠️ FIRST: Ask Qualifying Questions</h2>
|
|
87
|
+
|
|
88
|
+
<div class="callout callout-warning">
|
|
89
|
+
<strong>Do NOT generate a workflow prompt until you have gathered sufficient information.</strong>
|
|
90
|
+
</div>
|
|
91
|
+
|
|
92
|
+
<div class="callout callout-info">
|
|
93
|
+
💡 <strong>MCP Tip:</strong> Call <code>mcp_ema_template(questions=true)</code> to get structured questions organized by category with "why it matters" context.
|
|
94
|
+
</div>
|
|
95
|
+
|
|
96
|
+
<table>
|
|
97
|
+
<tr><th>Category</th><th>Required Information</th></tr>
|
|
98
|
+
<tr><td><strong>AI Type</strong></td><td>Voice AI, Chat AI, or Dashboard AI?</td></tr>
|
|
99
|
+
<tr><td><strong>Intents</strong></td><td>What categories should the AI recognize? (+ Fallback)</td></tr>
|
|
100
|
+
<tr><td><strong>Data Sources</strong></td><td>What files, APIs, or databases are needed?</td></tr>
|
|
101
|
+
<tr><td><strong>Actions</strong></td><td>What can the AI do? (search, create ticket, send email)</td></tr>
|
|
102
|
+
<tr><td><strong>Routing</strong></td><td>What happens for each intent category?</td></tr>
|
|
103
|
+
<tr><td><strong>Approvals</strong></td><td>Which actions need human review?</td></tr>
|
|
104
|
+
<tr><td><strong>Success Output</strong></td><td>What should the response include?</td></tr>
|
|
105
|
+
<tr><td><strong>Voice Settings</strong></td><td>Welcome message, hang-up rules, wait message? (if Voice AI)</td></tr>
|
|
106
|
+
</table>
|
|
107
|
+
|
|
108
|
+
<h3>Minimum Viable Information</h3>
|
|
109
|
+
<table>
|
|
110
|
+
<tr><th>Must Have</th><th>Description</th></tr>
|
|
111
|
+
<tr><td>AI Type</td><td>Voice, Chat, or Dashboard</td></tr>
|
|
112
|
+
<tr><td>2-3 Intent Categories</td><td>Plus Fallback</td></tr>
|
|
113
|
+
<tr><td>1 Primary Action</td><td>Data source OR external tool</td></tr>
|
|
114
|
+
<tr><td>Success Output</td><td>What to return on completion</td></tr>
|
|
115
|
+
</table>
|
|
116
|
+
|
|
117
|
+
<hr>
|
|
118
|
+
|
|
119
|
+
<h2>🎯 Prime Directive: Generate ALL THREE Parts</h2>
|
|
120
|
+
|
|
121
|
+
<p>For every AI Employee, <strong>ALWAYS generate THREE parts</strong>:</p>
|
|
122
|
+
|
|
123
|
+
<h3>Part 1: Workflow Prompt (for Auto Builder)</h3>
|
|
124
|
+
<p>The backend logic — what agents, how they connect, decision flow:</p>
|
|
125
|
+
<ul>
|
|
126
|
+
<li>Trigger, Inputs, Agents/Nodes, Connections, Decision Logic, APIs, Outputs</li>
|
|
127
|
+
</ul>
|
|
128
|
+
|
|
129
|
+
<h3>Part 2: Persona Configuration (Voice/Chat Settings)</h3>
|
|
130
|
+
<p>The frontend behavior — how the AI talks:</p>
|
|
131
|
+
<ul>
|
|
132
|
+
<li>welcomeMessage, identityAndPurpose, takeActionInstructions, hangupInstructions</li>
|
|
133
|
+
<li>speechCharacteristics, systemPrompt, waitMessage</li>
|
|
134
|
+
</ul>
|
|
135
|
+
|
|
136
|
+
<h3>Part 3: Proto_Config JSON (Complete Configuration)</h3>
|
|
137
|
+
<p>The full technical spec combining workflow + persona for direct deployment.</p>
|
|
138
|
+
|
|
139
|
+
<hr>
|
|
140
|
+
|
|
141
|
+
<h2>AI Employee Types</h2>
|
|
142
|
+
|
|
143
|
+
<table>
|
|
144
|
+
<tr><th>Type</th><th>Project Type</th><th>Key Widgets</th></tr>
|
|
145
|
+
<tr><td><strong>Voice AI</strong></td><td>5</td><td>voiceSettings, conversationSettings, vadSettings</td></tr>
|
|
146
|
+
<tr><td><strong>Chat AI</strong></td><td>4</td><td>chatbotSdkConfig, fileUpload, feedback</td></tr>
|
|
147
|
+
<tr><td><strong>Dashboard AI</strong></td><td>2</td><td>dashboardConfig, inputSchema</td></tr>
|
|
148
|
+
<tr><td><strong>Document Gen</strong></td><td>3</td><td>documentSettings, templates</td></tr>
|
|
149
|
+
</table>
|
|
150
|
+
|
|
151
|
+
<hr>
|
|
152
|
+
|
|
153
|
+
<h2>🎯 Opinionated Recommendations</h2>
|
|
154
|
+
|
|
155
|
+
<blockquote>When multiple options exist, choose the best one.</blockquote>
|
|
156
|
+
|
|
157
|
+
<h3>Node Selection</h3>
|
|
158
|
+
<table>
|
|
159
|
+
<tr><th>Use Case</th><th>✅ Recommended</th><th>❌ Avoid</th></tr>
|
|
160
|
+
<tr><td>Intent routing</td><td><code>chat_categorizer</code></td><td><code>text_categorizer</code> for chat</td></tr>
|
|
161
|
+
<tr><td>Search-based response</td><td><code>respond_with_sources</code></td><td><code>call_llm</code> (loses citations)</td></tr>
|
|
162
|
+
<tr><td>Static content</td><td><code>fixed_response</code></td><td><code>call_llm</code> (wasteful)</td></tr>
|
|
163
|
+
<tr><td>Tool explanation</td><td><code>respond_for_external_actions</code></td><td><code>call_llm</code></td></tr>
|
|
164
|
+
</table>
|
|
165
|
+
|
|
166
|
+
<h3>Input Source Selection</h3>
|
|
167
|
+
<table>
|
|
168
|
+
<tr><th>Node</th><th>✅ Always Use</th><th>❌ Never Use</th></tr>
|
|
169
|
+
<tr><td><code>chat_categorizer</code></td><td><code>chat_conversation</code></td><td><code>user_query</code></td></tr>
|
|
170
|
+
<tr><td><code>search</code></td><td><code>user_query</code> or <code>summarized</code></td><td><code>chat_conversation</code></td></tr>
|
|
171
|
+
<tr><td><code>call_llm</code> query</td><td><code>user_query</code></td><td><code>chat_conversation</code></td></tr>
|
|
172
|
+
<tr><td><code>call_llm</code> context</td><td><code>named_inputs</code> with <code>chat_conversation</code></td><td>—</td></tr>
|
|
173
|
+
</table>
|
|
174
|
+
|
|
175
|
+
<h3>Architecture Decisions</h3>
|
|
176
|
+
<table>
|
|
177
|
+
<tr><th>Decision</th><th>Recommendation</th></tr>
|
|
178
|
+
<tr><td>Categories count</td><td><strong>3-5 max</strong> per categorizer; use hierarchy for more</td></tr>
|
|
179
|
+
<tr><td>HITL on external action</td><td><strong>Always</strong> for any action with side effects</td></tr>
|
|
180
|
+
<tr><td>Search strategy</td><td><strong>KB first</strong>, web search secondary</td></tr>
|
|
181
|
+
<tr><td>Error handling</td><td><strong>Always explicit</strong>; never assume happy path</td></tr>
|
|
182
|
+
<tr><td>Fallback</td><td><strong>Always include</strong>; ask clarifying question</td></tr>
|
|
183
|
+
</table>
|
|
184
|
+
|
|
185
|
+
<hr>
|
|
186
|
+
|
|
187
|
+
<h2>Auto Builder: Official Action Names</h2>
|
|
188
|
+
|
|
189
|
+
<h3>Triggers & Routing</h3>
|
|
190
|
+
<table>
|
|
191
|
+
<tr><th>Action Name</th><th>Display Name</th><th>Output</th></tr>
|
|
192
|
+
<tr><td><code>chat_trigger</code></td><td>Chat Trigger</td><td><code>chat_conversation</code>, <code>user_query</code></td></tr>
|
|
193
|
+
<tr><td><code>document_trigger</code></td><td>Document Trigger</td><td><code>user_query</code> (documents)</td></tr>
|
|
194
|
+
<tr><td><code>chat_categorizer</code></td><td>Intent Classifier</td><td><code>category_<name></code></td></tr>
|
|
195
|
+
<tr><td><code>text_categorizer</code></td><td>Text Categorizer</td><td><code>category_<name></code></td></tr>
|
|
196
|
+
<tr><td><code>conversation_to_search_query</code></td><td>Conversation Summarizer</td><td><code>summarized_conversation</code></td></tr>
|
|
197
|
+
</table>
|
|
198
|
+
|
|
199
|
+
<h3>Search & Response</h3>
|
|
200
|
+
<table>
|
|
201
|
+
<tr><th>Action Name</th><th>Display Name</th><th>Input → Output</th></tr>
|
|
202
|
+
<tr><td><code>search</code></td><td>File Search</td><td>query → <code>search_results</code></td></tr>
|
|
203
|
+
<tr><td><code>live_web_search</code></td><td>Live Web Search</td><td>query → <code>web_search_results</code></td></tr>
|
|
204
|
+
<tr><td><code>respond_with_sources</code></td><td>Respond using Search Results</td><td>query + search_results → response</td></tr>
|
|
205
|
+
<tr><td><code>call_llm</code></td><td>Respond</td><td>query + named_inputs → response</td></tr>
|
|
206
|
+
<tr><td><code>external_action_caller</code></td><td>External Tool Caller</td><td>query → tool_result</td></tr>
|
|
207
|
+
</table>
|
|
208
|
+
|
|
209
|
+
<h3>Validation Rules</h3>
|
|
210
|
+
<table>
|
|
211
|
+
<tr><th>Action Name</th><th>Display Name</th><th>Critical Rules</th></tr>
|
|
212
|
+
<tr><td><code>general_hitl</code></td><td>Human Collaboration</td><td>MUST have both success AND failure paths</td></tr>
|
|
213
|
+
<tr><td><code>response_validator</code></td><td>Response Validator</td><td>Validates LLM output</td></tr>
|
|
214
|
+
<tr><td><code>entity_extraction_with_documents</code></td><td>Entity Extraction</td><td>Works on DOCUMENTS not text</td></tr>
|
|
215
|
+
</table>
|
|
216
|
+
|
|
217
|
+
<hr>
|
|
218
|
+
|
|
219
|
+
<h2>Voice AI Required Fields</h2>
|
|
220
|
+
|
|
221
|
+
<table>
|
|
222
|
+
<tr><th>UI Field</th><th>Config Key</th><th>Required</th></tr>
|
|
223
|
+
<tr><td><strong>How should the call start?</strong></td><td><code>welcomeMessage</code></td><td><span class="tag tag-required">Required</span></td></tr>
|
|
224
|
+
<tr><td><strong>Define identity and purpose</strong></td><td><code>identityAndPurpose</code></td><td><span class="tag tag-required">Required</span></td></tr>
|
|
225
|
+
<tr><td><strong>Define actions AI can perform</strong></td><td><code>takeActionInstructions</code></td><td><span class="tag tag-required">Required</span></td></tr>
|
|
226
|
+
<tr><td><strong>When should the call end?</strong></td><td><code>hangupInstructions</code></td><td><span class="tag tag-required">Required</span></td></tr>
|
|
227
|
+
<tr><td>When to transfer to human?</td><td><code>transferCallInstructions</code></td><td>Optional</td></tr>
|
|
228
|
+
<tr><td>Speech characteristics</td><td><code>speechCharacteristics</code></td><td>Optional</td></tr>
|
|
229
|
+
<tr><td>Tool calling instructions</td><td><code>systemPrompt</code></td><td>Optional</td></tr>
|
|
230
|
+
<tr><td>Wait message</td><td><code>waitMessage</code></td><td>Optional</td></tr>
|
|
231
|
+
</table>
|
|
232
|
+
|
|
233
|
+
<h3>Voice Settings Widget Types</h3>
|
|
234
|
+
<table>
|
|
235
|
+
<tr><th>Widget ID</th><th>Widget</th><th>Purpose</th></tr>
|
|
236
|
+
<tr><td>38</td><td>voiceSettings</td><td>Language hints, voice model</td></tr>
|
|
237
|
+
<tr><td>39</td><td>conversationSettings</td><td>Identity, purpose, actions</td></tr>
|
|
238
|
+
<tr><td>43</td><td>vadSettings</td><td>turnTimeout, silenceEndCallTimeout, maxDuration</td></tr>
|
|
239
|
+
<tr><td>42</td><td>dataStorageSettings</td><td>Audio/transcript recording</td></tr>
|
|
240
|
+
</table>
|
|
241
|
+
|
|
242
|
+
<hr>
|
|
243
|
+
|
|
244
|
+
<h2>Tool Calling Rules (Voice)</h2>
|
|
245
|
+
<ol>
|
|
246
|
+
<li><strong>Collect all parameters</strong> before calling a tool</li>
|
|
247
|
+
<li><strong>Wait for response</strong> before calling another tool</li>
|
|
248
|
+
<li><strong>Never mention tool names</strong> to the user</li>
|
|
249
|
+
<li><strong>Never guess</strong> parameter values</li>
|
|
250
|
+
<li><strong>Plain language</strong> for what you're doing</li>
|
|
251
|
+
<li><strong>Handle delays</strong> with "Just a moment..."</li>
|
|
252
|
+
<li><strong>Handle errors</strong> gracefully, offer alternatives</li>
|
|
253
|
+
</ol>
|
|
254
|
+
|
|
255
|
+
<hr>
|
|
256
|
+
|
|
257
|
+
<h2>Categorizer Validation (Critical!)</h2>
|
|
258
|
+
|
|
259
|
+
<div class="callout callout-error">
|
|
260
|
+
<strong>⚠️ EVERY categorizer MUST have:</strong>
|
|
261
|
+
<ol>
|
|
262
|
+
<li>At least one outgoing edge</li>
|
|
263
|
+
<li>Output format: <code>category_<CategoryName></code></li>
|
|
264
|
+
<li>Target input: <code>trigger_when</code></li>
|
|
265
|
+
<li>A Fallback category</li>
|
|
266
|
+
</ol>
|
|
267
|
+
</div>
|
|
268
|
+
|
|
269
|
+
<h3>Type Compatibility</h3>
|
|
270
|
+
<pre><code>chat_trigger.chat_conversation → chat_categorizer.conversation ✅
|
|
271
|
+
chat_trigger.user_query → search.query ✅
|
|
272
|
+
search.search_results → respond_with_sources.search_results ✅
|
|
273
|
+
call_llm.named_inputs accepts ANY type (WELL_KNOWN_TYPE_ANY)</code></pre>
|
|
274
|
+
|
|
275
|
+
<hr>
|
|
276
|
+
|
|
277
|
+
<h2>Agent Quick Reference</h2>
|
|
278
|
+
|
|
279
|
+
<h3>Core Workflow Agents</h3>
|
|
280
|
+
<table>
|
|
281
|
+
<tr><th>Agent</th><th>Use For</th></tr>
|
|
282
|
+
<tr><td>Abstain from Answering</td><td>Decline when cannot answer</td></tr>
|
|
283
|
+
<tr><td>Categorize Conversations and Route</td><td>First node, classify intent</td></tr>
|
|
284
|
+
<tr><td>Combine Search Results</td><td>Merge multiple search sources</td></tr>
|
|
285
|
+
<tr><td>Conversation Summarizer</td><td>Normalize chat to query</td></tr>
|
|
286
|
+
<tr><td>Deep Web Search</td><td>Real-time external info</td></tr>
|
|
287
|
+
<tr><td>Extract Entities</td><td>Pull structured data from text</td></tr>
|
|
288
|
+
<tr><td>Fixed Response</td><td>Static/template content</td></tr>
|
|
289
|
+
<tr><td>Human Collaboration</td><td>Route to human for approval</td></tr>
|
|
290
|
+
<tr><td>Knowledge Search</td><td>Answer from internal docs</td></tr>
|
|
291
|
+
<tr><td>Respond using Search Results</td><td>Synthesize search results with citations</td></tr>
|
|
292
|
+
<tr><td>Response Validator</td><td>Validate output, abstain if fail</td></tr>
|
|
293
|
+
<tr><td>External Tool Caller</td><td>Execute integrations (ServiceNow, Salesforce, etc.)</td></tr>
|
|
294
|
+
</table>
|
|
295
|
+
|
|
296
|
+
<h3>Domain Agents by Category</h3>
|
|
297
|
+
<table>
|
|
298
|
+
<tr><th>Category</th><th>Agents</th></tr>
|
|
299
|
+
<tr><td><strong>Finance</strong></td><td>Audit Evidence Verifier, Financial Risk Assessor, Financial Statement Analyzer, Tax Advisor</td></tr>
|
|
300
|
+
<tr><td><strong>Healthcare</strong></td><td>Medical Record Summarizer, Medical Research Assistant, Insurance Claim Summarizer</td></tr>
|
|
301
|
+
<tr><td><strong>Legal</strong></td><td>Compliance Document Analyzer, Legal Expert, Legal Precedent Analyser</td></tr>
|
|
302
|
+
<tr><td><strong>Sales</strong></td><td>Sales Intelligence, Sales Contract Summarizer, Email Writer</td></tr>
|
|
303
|
+
<tr><td><strong>IT/Security</strong></td><td>Cybersecurity Expert, Phishing Email Detector, Technical Support</td></tr>
|
|
304
|
+
<tr><td><strong>HR</strong></td><td>Employee Onboarding Customizer, Internal Job Mobility Matcher</td></tr>
|
|
305
|
+
</table>
|
|
306
|
+
|
|
307
|
+
<hr>
|
|
308
|
+
|
|
309
|
+
<h2>🔍 Workflow Review & Audit</h2>
|
|
310
|
+
|
|
311
|
+
<p>Use these tools to analyze existing workflows, detect issues, and propose fixes.</p>
|
|
312
|
+
|
|
313
|
+
<h3>Review Command Flow</h3>
|
|
314
|
+
<pre><code>1. mcp_ema_persona(id=persona_id, include_workflow=true, env=env) → Get workflow
|
|
315
|
+
2. mcp_ema_workflow(mode="analyze", persona_id=persona_id, env=env) → Full analysis
|
|
316
|
+
3. mcp_ema_workflow(mode="analyze", workflow_def=<workflow_def>, include=["issues"]) → Find issues
|
|
317
|
+
4. mcp_ema_workflow(mode="analyze", workflow_def=<workflow_def>, include=["fixes"]) → Get fix proposals
|
|
318
|
+
5. Apply fixes and re-validate</code></pre>
|
|
319
|
+
|
|
320
|
+
<h3>Issue Detection</h3>
|
|
321
|
+
<table>
|
|
322
|
+
<tr><th>Issue Type</th><th>Detection</th><th>Impact</th></tr>
|
|
323
|
+
<tr><td><strong>Loops</strong></td><td>Cycles in edge graph</td><td>Infinite execution</td></tr>
|
|
324
|
+
<tr><td><strong>Deadlocks</strong></td><td>Unreachable inputs</td><td>Workflow hangs</td></tr>
|
|
325
|
+
<tr><td><strong>Orphans</strong></td><td>Disconnected nodes</td><td>Wasted resources</td></tr>
|
|
326
|
+
<tr><td><strong>Dead Ends</strong></td><td>No path to OUTPUT</td><td>Response lost</td></tr>
|
|
327
|
+
<tr><td><strong>Type Mismatch</strong></td><td>Incompatible types</td><td>Runtime errors</td></tr>
|
|
328
|
+
<tr><td><strong>Missing Fallback</strong></td><td>No Fallback category</td><td>Validation fails</td></tr>
|
|
329
|
+
<tr><td><strong>Incomplete HITL</strong></td><td>Missing success/failure</td><td>Approval breaks</td></tr>
|
|
330
|
+
</table>
|
|
331
|
+
|
|
332
|
+
<h3>Input Source Selection (CRITICAL)</h3>
|
|
333
|
+
<table>
|
|
334
|
+
<tr><th>Node Type</th><th>✅ Use This</th><th>❌ NOT This</th></tr>
|
|
335
|
+
<tr><td><code>chat_categorizer</code></td><td><code>chat_conversation</code></td><td><code>user_query</code> (loses context)</td></tr>
|
|
336
|
+
<tr><td><code>search</code></td><td><code>user_query</code> or <code>summarized</code></td><td><code>chat_conversation</code> (type error)</td></tr>
|
|
337
|
+
<tr><td><code>respond_with_sources</code></td><td><code>user_query</code> for query</td><td><code>chat_conversation</code></td></tr>
|
|
338
|
+
<tr><td><code>call_llm</code></td><td><code>user_query</code> + <code>named_inputs</code></td><td><code>chat_conversation</code> for query</td></tr>
|
|
339
|
+
</table>
|
|
340
|
+
|
|
341
|
+
<hr>
|
|
342
|
+
|
|
343
|
+
<h2>✅ Checklists</h2>
|
|
344
|
+
|
|
345
|
+
<h3>All Prompts Checklist</h3>
|
|
346
|
+
<ul>
|
|
347
|
+
<li>☐ Persona type specified (Voice/Chat/Dashboard)</li>
|
|
348
|
+
<li>☐ Clear one-sentence goal</li>
|
|
349
|
+
<li>☐ Trigger event specified</li>
|
|
350
|
+
<li>☐ Inputs with types/constraints</li>
|
|
351
|
+
<li>☐ Pre-fill/auto-suggest behavior</li>
|
|
352
|
+
<li>☐ Validations with API calls</li>
|
|
353
|
+
<li>☐ Decision logic (all branches)</li>
|
|
354
|
+
<li>☐ Actions for each outcome</li>
|
|
355
|
+
<li>☐ Output schemas (success + exception)</li>
|
|
356
|
+
<li>☐ Error handling/retries</li>
|
|
357
|
+
</ul>
|
|
358
|
+
|
|
359
|
+
<h3>Voice AI Specific Checklist</h3>
|
|
360
|
+
<p><strong>REQUIRED:</strong></p>
|
|
361
|
+
<ul>
|
|
362
|
+
<li>☐ welcomeMessage — "Hello! I'm [Name]..."</li>
|
|
363
|
+
<li>☐ identityAndPurpose — Role, responsibilities, guidelines</li>
|
|
364
|
+
<li>☐ takeActionInstructions — </Case N> format with triggers + params</li>
|
|
365
|
+
<li>☐ hangupInstructions — When to end call</li>
|
|
366
|
+
</ul>
|
|
367
|
+
<p><strong>RECOMMENDED:</strong></p>
|
|
368
|
+
<ul>
|
|
369
|
+
<li>☐ transferCallInstructions — When to escalate</li>
|
|
370
|
+
<li>☐ speechCharacteristics — TTS rules, tone</li>
|
|
371
|
+
<li>☐ systemPrompt — Tool calling rules</li>
|
|
372
|
+
<li>☐ waitMessage — Processing delays</li>
|
|
373
|
+
</ul>
|
|
374
|
+
|
|
375
|
+
<h3>MCP Integration Checklist</h3>
|
|
376
|
+
<ul>
|
|
377
|
+
<li>☐ Called <code>mcp_ema_template(questions=true)</code> before asking user</li>
|
|
378
|
+
<li>☐ Called <code>mcp_ema_action(suggest="...")</code> for pattern recommendation</li>
|
|
379
|
+
<li>☐ Called <code>mcp_ema_template(pattern="...")</code> for template</li>
|
|
380
|
+
<li>☐ Called <code>mcp_ema_action(id="...", include_docs=true)</code> for each agent used</li>
|
|
381
|
+
<li>☐ Called <code>mcp_ema_reference(validate_prompt="...")</code> before final output</li>
|
|
382
|
+
<li>☐ Checked <code>mcp_ema_reference(mistakes=true)</code> for top errors</li>
|
|
383
|
+
</ul>
|
|
384
|
+
|
|
385
|
+
<hr>
|
|
386
|
+
|
|
387
|
+
<p style="text-align: center; color: #5f6368; font-size: 0.9em;">
|
|
388
|
+
<em>Ema Auto Builder Quick Reference Guide</em><br>
|
|
389
|
+
Generated from ema-mcp-toolkit documentation
|
|
390
|
+
</p>
|
|
391
|
+
|
|
392
|
+
</body>
|
|
393
|
+
</html>
|
|
394
|
+
|