@botuyo/mcp 0.2.11 → 0.2.13
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/tools/example_agent.d.ts +147 -0
- package/dist/tools/example_agent.js +172 -0
- package/dist/tools/example_agent.js.map +1 -0
- package/dist/tools/export_agent_json.js +41 -3
- package/dist/tools/export_agent_json.js.map +1 -1
- package/dist/tools/index.js +3 -0
- package/dist/tools/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import type { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
export declare const EXAMPLE_AGENT_TOOL: Tool;
|
|
3
|
+
export declare function exampleAgentHandler(): Promise<{
|
|
4
|
+
success: boolean;
|
|
5
|
+
data: {
|
|
6
|
+
_comment: string;
|
|
7
|
+
name: string;
|
|
8
|
+
identity: {
|
|
9
|
+
tone: string;
|
|
10
|
+
language: string;
|
|
11
|
+
objective: string;
|
|
12
|
+
customInstructions: string;
|
|
13
|
+
};
|
|
14
|
+
stages: ({
|
|
15
|
+
id: string;
|
|
16
|
+
name: string;
|
|
17
|
+
type: string;
|
|
18
|
+
instruction: string;
|
|
19
|
+
tools: never[];
|
|
20
|
+
_types: string;
|
|
21
|
+
_note?: undefined;
|
|
22
|
+
} | {
|
|
23
|
+
id: string;
|
|
24
|
+
name: string;
|
|
25
|
+
type: string;
|
|
26
|
+
instruction: string;
|
|
27
|
+
tools: string[];
|
|
28
|
+
_note: string;
|
|
29
|
+
_types?: undefined;
|
|
30
|
+
} | {
|
|
31
|
+
id: string;
|
|
32
|
+
name: string;
|
|
33
|
+
type: string;
|
|
34
|
+
instruction: string;
|
|
35
|
+
tools: string[];
|
|
36
|
+
_types?: undefined;
|
|
37
|
+
_note?: undefined;
|
|
38
|
+
})[];
|
|
39
|
+
connections: ({
|
|
40
|
+
id: string;
|
|
41
|
+
from: string;
|
|
42
|
+
to: string;
|
|
43
|
+
type: string;
|
|
44
|
+
_note: string;
|
|
45
|
+
condition?: undefined;
|
|
46
|
+
} | {
|
|
47
|
+
id: string;
|
|
48
|
+
from: string;
|
|
49
|
+
to: string;
|
|
50
|
+
type: string;
|
|
51
|
+
condition: string;
|
|
52
|
+
_note: string;
|
|
53
|
+
} | {
|
|
54
|
+
id: string;
|
|
55
|
+
from: string;
|
|
56
|
+
to: string;
|
|
57
|
+
type: string;
|
|
58
|
+
condition: string;
|
|
59
|
+
_note?: undefined;
|
|
60
|
+
})[];
|
|
61
|
+
channelFlows: {
|
|
62
|
+
phone: {
|
|
63
|
+
connections: ({
|
|
64
|
+
id: string;
|
|
65
|
+
from: string;
|
|
66
|
+
to: string;
|
|
67
|
+
type: string;
|
|
68
|
+
condition?: undefined;
|
|
69
|
+
} | {
|
|
70
|
+
id: string;
|
|
71
|
+
from: string;
|
|
72
|
+
to: string;
|
|
73
|
+
type: string;
|
|
74
|
+
condition: string;
|
|
75
|
+
})[];
|
|
76
|
+
_note: string;
|
|
77
|
+
};
|
|
78
|
+
whatsapp: {
|
|
79
|
+
connections: ({
|
|
80
|
+
id: string;
|
|
81
|
+
from: string;
|
|
82
|
+
to: string;
|
|
83
|
+
type: string;
|
|
84
|
+
condition?: undefined;
|
|
85
|
+
} | {
|
|
86
|
+
id: string;
|
|
87
|
+
from: string;
|
|
88
|
+
to: string;
|
|
89
|
+
type: string;
|
|
90
|
+
condition: string;
|
|
91
|
+
})[];
|
|
92
|
+
_note: string;
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
enabledTools: string[];
|
|
96
|
+
_enabledToolsNote: string;
|
|
97
|
+
channels: string[];
|
|
98
|
+
_channelsNote: string;
|
|
99
|
+
widgetConfig: {
|
|
100
|
+
cssVariables: {
|
|
101
|
+
primary: string;
|
|
102
|
+
'primary-foreground': string;
|
|
103
|
+
background: string;
|
|
104
|
+
foreground: string;
|
|
105
|
+
muted: string;
|
|
106
|
+
'muted-foreground': string;
|
|
107
|
+
accent: string;
|
|
108
|
+
'accent-foreground': string;
|
|
109
|
+
border: string;
|
|
110
|
+
ring: string;
|
|
111
|
+
'chat-bubble-user': string;
|
|
112
|
+
'chat-bubble-user-foreground': string;
|
|
113
|
+
'chat-bubble-bot': string;
|
|
114
|
+
'chat-bubble-bot-foreground': string;
|
|
115
|
+
radius: string;
|
|
116
|
+
_note: string;
|
|
117
|
+
};
|
|
118
|
+
welcomeMessage: string;
|
|
119
|
+
placeholder: string;
|
|
120
|
+
position: string;
|
|
121
|
+
};
|
|
122
|
+
voice: {
|
|
123
|
+
profile: string;
|
|
124
|
+
widgetCallEnabled: boolean;
|
|
125
|
+
_note: string;
|
|
126
|
+
};
|
|
127
|
+
channelPrompts: {
|
|
128
|
+
whatsapp: string;
|
|
129
|
+
phone: string;
|
|
130
|
+
_note: string;
|
|
131
|
+
};
|
|
132
|
+
knowledgeDocumentIds: string[];
|
|
133
|
+
_knowledgeNote: string;
|
|
134
|
+
_readOnlyFields: {
|
|
135
|
+
apiKey: string;
|
|
136
|
+
_note: string;
|
|
137
|
+
};
|
|
138
|
+
_adminOnlyFields: {
|
|
139
|
+
model: string;
|
|
140
|
+
temperature: number;
|
|
141
|
+
summaryThreshold: number;
|
|
142
|
+
'voice.liveModel': string;
|
|
143
|
+
_note: string;
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
message: string;
|
|
147
|
+
}>;
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
export const EXAMPLE_AGENT_TOOL = {
|
|
2
|
+
name: 'example_agent',
|
|
3
|
+
description: `Returns a complete, documented example of an agent configuration JSON with ALL possible fields explained.
|
|
4
|
+
|
|
5
|
+
Use this as a reference when creating or editing agents. Every field includes a description of what it does,
|
|
6
|
+
its type, and valid values. This is a read-only reference tool — it doesn't create or modify anything.
|
|
7
|
+
|
|
8
|
+
Useful for:
|
|
9
|
+
- New users learning the agent config structure
|
|
10
|
+
- Checking available fields before using import_agent_json
|
|
11
|
+
- Understanding how stages, connections, channelFlows, and tools work together`,
|
|
12
|
+
inputSchema: {
|
|
13
|
+
type: 'object',
|
|
14
|
+
properties: {},
|
|
15
|
+
required: []
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
export async function exampleAgentHandler() {
|
|
19
|
+
const example = {
|
|
20
|
+
_comment: 'This is a complete reference of all agent configuration fields. Use export_agent_json to get your real config, edit it, and import_agent_json to apply.',
|
|
21
|
+
name: 'Mi Agente de Ejemplo',
|
|
22
|
+
identity: {
|
|
23
|
+
tone: 'Amigable, profesional y empático. Usá un tono cercano pero respetuoso.',
|
|
24
|
+
language: 'es-AR',
|
|
25
|
+
objective: 'Asistir a los usuarios con consultas sobre productos, reservas y soporte general.',
|
|
26
|
+
customInstructions: 'Instrucciones adicionales libres. Pueden incluir reglas de negocio, restricciones, o comportamiento especial.'
|
|
27
|
+
},
|
|
28
|
+
stages: [
|
|
29
|
+
{
|
|
30
|
+
id: 'greeting',
|
|
31
|
+
name: 'Saludo Inicial',
|
|
32
|
+
type: 'start',
|
|
33
|
+
instruction: 'Saludá al usuario de forma cálida y preguntale en qué lo podés ayudar. Si ya hay historial, no repitas el saludo.',
|
|
34
|
+
tools: [],
|
|
35
|
+
_types: 'type can be: start, action, router, end. Only 1 start allowed.'
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
id: 'guest_discovery',
|
|
39
|
+
name: 'Descubrimiento',
|
|
40
|
+
type: 'action',
|
|
41
|
+
instruction: 'Hacé preguntas para entender las necesidades del usuario: qué busca, fechas, presupuesto, etc.',
|
|
42
|
+
tools: ['search_accommodations', 'search_knowledge_base'],
|
|
43
|
+
_note: 'tools[] lists tool IDs available in THIS stage. They must also be in enabledTools[].'
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
id: 'guest_booking',
|
|
47
|
+
name: 'Reserva',
|
|
48
|
+
type: 'action',
|
|
49
|
+
instruction: 'Guiá al usuario por el proceso de reserva. Mostrá opciones de pago y confirmá los datos.',
|
|
50
|
+
tools: ['create_pre_reservation', 'get_accommodation_details']
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
id: 'farewell',
|
|
54
|
+
name: 'Despedida',
|
|
55
|
+
type: 'end',
|
|
56
|
+
instruction: 'Despedite amablemente. Agradecé la conversación y ofrecé ayuda futura.',
|
|
57
|
+
tools: []
|
|
58
|
+
}
|
|
59
|
+
],
|
|
60
|
+
connections: [
|
|
61
|
+
{
|
|
62
|
+
id: 'c1',
|
|
63
|
+
from: 'greeting',
|
|
64
|
+
to: 'guest_discovery',
|
|
65
|
+
type: 'default',
|
|
66
|
+
_note: 'Default connections always transition. No condition needed.'
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
id: 'c2',
|
|
70
|
+
from: 'guest_discovery',
|
|
71
|
+
to: 'guest_booking',
|
|
72
|
+
type: 'conditional',
|
|
73
|
+
condition: 'El usuario expresó interés en reservar una opción específica',
|
|
74
|
+
_note: 'Conditional connections: the LLM evaluates the condition to decide if to transition.'
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
id: 'c3',
|
|
78
|
+
from: 'guest_booking',
|
|
79
|
+
to: 'farewell',
|
|
80
|
+
type: 'conditional',
|
|
81
|
+
condition: 'La reserva fue completada exitosamente o el usuario quiere terminar'
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
id: 'c_disc_farewell',
|
|
85
|
+
from: 'guest_discovery',
|
|
86
|
+
to: 'farewell',
|
|
87
|
+
type: 'conditional',
|
|
88
|
+
condition: 'El usuario quiere despedirse sin reservar'
|
|
89
|
+
}
|
|
90
|
+
],
|
|
91
|
+
channelFlows: {
|
|
92
|
+
phone: {
|
|
93
|
+
connections: [
|
|
94
|
+
{ id: 'phone_c1', from: 'greeting', to: 'guest_discovery', type: 'default' },
|
|
95
|
+
{ id: 'phone_c2', from: 'guest_discovery', to: 'farewell', type: 'conditional', condition: 'El usuario quiere terminar' }
|
|
96
|
+
],
|
|
97
|
+
_note: 'ChannelFlows override the default connections for a specific channel. Here, phone skips booking (tools not phone-compatible).'
|
|
98
|
+
},
|
|
99
|
+
whatsapp: {
|
|
100
|
+
connections: [
|
|
101
|
+
{ id: 'wa_c1', from: 'greeting', to: 'guest_discovery', type: 'default' },
|
|
102
|
+
{ id: 'wa_c2', from: 'guest_discovery', to: 'guest_booking', type: 'conditional', condition: 'Quiere reservar' },
|
|
103
|
+
{ id: 'wa_c3', from: 'guest_booking', to: 'farewell', type: 'conditional', condition: 'Reserva completada' }
|
|
104
|
+
],
|
|
105
|
+
_note: 'If a channel is NOT in channelFlows, it uses the default connections array.'
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
enabledTools: [
|
|
109
|
+
'search_accommodations',
|
|
110
|
+
'get_accommodation_details',
|
|
111
|
+
'create_pre_reservation',
|
|
112
|
+
'search_knowledge_base',
|
|
113
|
+
'identify_user_context',
|
|
114
|
+
'update_user_profile'
|
|
115
|
+
],
|
|
116
|
+
_enabledToolsNote: 'All tools the agent can use across all stages. Per-stage tools[] must be a subset of this. Use list_available_tools to see all options.',
|
|
117
|
+
channels: ['web', 'whatsapp', 'phone'],
|
|
118
|
+
_channelsNote: 'Valid channels: web, whatsapp, telegram, discord, instagram, phone. Runtime filters tools by channel compatibility.',
|
|
119
|
+
widgetConfig: {
|
|
120
|
+
cssVariables: {
|
|
121
|
+
primary: '210 100% 50%',
|
|
122
|
+
'primary-foreground': '0 0% 100%',
|
|
123
|
+
background: '222 47% 6%',
|
|
124
|
+
foreground: '210 40% 98%',
|
|
125
|
+
muted: '217 33% 17%',
|
|
126
|
+
'muted-foreground': '215 20% 65%',
|
|
127
|
+
accent: '210 100% 50%',
|
|
128
|
+
'accent-foreground': '0 0% 100%',
|
|
129
|
+
border: '217 33% 17%',
|
|
130
|
+
ring: '210 100% 50%',
|
|
131
|
+
'chat-bubble-user': '210 100% 50%',
|
|
132
|
+
'chat-bubble-user-foreground': '0 0% 100%',
|
|
133
|
+
'chat-bubble-bot': '217 33% 17%',
|
|
134
|
+
'chat-bubble-bot-foreground': '210 40% 98%',
|
|
135
|
+
radius: '0.75rem',
|
|
136
|
+
_note: 'HSL values WITHOUT the hsl() wrapper. Widget uses these as CSS custom properties.'
|
|
137
|
+
},
|
|
138
|
+
welcomeMessage: '¡Hola! 👋 Soy tu asistente virtual. ¿En qué puedo ayudarte?',
|
|
139
|
+
placeholder: 'Escribí tu mensaje...',
|
|
140
|
+
position: 'bottom-right'
|
|
141
|
+
},
|
|
142
|
+
voice: {
|
|
143
|
+
profile: 'Coral Cálida',
|
|
144
|
+
widgetCallEnabled: true,
|
|
145
|
+
_note: 'profile is the display name of a voice profile (use list_voice_profiles to see options). liveModel is admin-only and auto-preserved.'
|
|
146
|
+
},
|
|
147
|
+
channelPrompts: {
|
|
148
|
+
whatsapp: 'Recordá que estás hablando por WhatsApp. Usá mensajes cortos y directos. Evitá markdown complejo.',
|
|
149
|
+
phone: 'Estás en una llamada telefónica. Hablá de forma natural, sin usar formato visual. Sé conciso.',
|
|
150
|
+
_note: 'Per-channel system prompt overrides. Merged into the base prompt when that channel is active.'
|
|
151
|
+
},
|
|
152
|
+
knowledgeDocumentIds: ['doc_abc123', 'doc_def456'],
|
|
153
|
+
_knowledgeNote: 'MongoDB IDs of knowledge base documents for RAG. The agent will search these for context.',
|
|
154
|
+
_readOnlyFields: {
|
|
155
|
+
apiKey: 'agent_cce16580e147497ba5a35ff4c4947066',
|
|
156
|
+
_note: 'apiKey is shown in export but cannot be modified via import. Used for external API integrations.'
|
|
157
|
+
},
|
|
158
|
+
_adminOnlyFields: {
|
|
159
|
+
model: 'gemini-2.0-flash',
|
|
160
|
+
temperature: 0.7,
|
|
161
|
+
summaryThreshold: 15,
|
|
162
|
+
'voice.liveModel': 'gemini-2.0-flash-live-001',
|
|
163
|
+
_note: 'These fields are only editable via the admin panel, never via MCP import.'
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
return {
|
|
167
|
+
success: true,
|
|
168
|
+
data: example,
|
|
169
|
+
message: 'This is a complete reference of all agent configuration fields. Fields prefixed with _ are documentation-only and should be removed when using import_agent_json.'
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
//# sourceMappingURL=example_agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"example_agent.js","sourceRoot":"","sources":["../../src/tools/example_agent.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,kBAAkB,GAAS;IACtC,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE;;;;;;;;+EAQgE;IAC7E,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,EAAE;QACd,QAAQ,EAAE,EAAE;KACb;CACF,CAAA;AAED,MAAM,CAAC,KAAK,UAAU,mBAAmB;IACvC,MAAM,OAAO,GAAG;QACd,QAAQ,EAAE,yJAAyJ;QAEnK,IAAI,EAAE,sBAAsB;QAE5B,QAAQ,EAAE;YACR,IAAI,EAAE,wEAAwE;YAC9E,QAAQ,EAAE,OAAO;YACjB,SAAS,EAAE,mFAAmF;YAC9F,kBAAkB,EAAE,+GAA+G;SACpI;QAED,MAAM,EAAE;YACN;gBACE,EAAE,EAAE,UAAU;gBACd,IAAI,EAAE,gBAAgB;gBACtB,IAAI,EAAE,OAAO;gBACb,WAAW,EAAE,mHAAmH;gBAChI,KAAK,EAAE,EAAE;gBACT,MAAM,EAAE,gEAAgE;aACzE;YACD;gBACE,EAAE,EAAE,iBAAiB;gBACrB,IAAI,EAAE,gBAAgB;gBACtB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,gGAAgG;gBAC7G,KAAK,EAAE,CAAC,uBAAuB,EAAE,uBAAuB,CAAC;gBACzD,KAAK,EAAE,sFAAsF;aAC9F;YACD;gBACE,EAAE,EAAE,eAAe;gBACnB,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,0FAA0F;gBACvG,KAAK,EAAE,CAAC,wBAAwB,EAAE,2BAA2B,CAAC;aAC/D;YACD;gBACE,EAAE,EAAE,U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,KAAK,EAAE,+FAA+F;YACtG,KAAK,EAAE,+FAA+F;SACvG;QAED,oBAAoB,EAAE,CAAC,YAAY,EAAE,YAAY,CAAC;QAClD,cAAc,EAAE,2FAA2F;QAE3G,eAAe,EAAE;YACf,MAAM,EAAE,wCAAwC;YAChD,KAAK,EAAE,kGAAkG;SAC1G;QAED,gBAAgB,EAAE;YAChB,KAAK,EAAE,kBAAkB;YACzB,WAAW,EAAE,GAAG;YAChB,gBAAgB,EAAE,EAAE;YACpB,iBAAiB,EAAE,2BAA2B;YAC9C,KAAK,EAAE,2EAA2E;SACnF;KACF,CAAA;IAED,OAAO;QACL,OAAO,EAAE,IAAI;QACb,IAAI,EAAE,OAAO;QACb,OAAO,EAAE,mKAAmK;KAC7K,CAAA;AACH,CAAC"}
|
|
@@ -1,21 +1,59 @@
|
|
|
1
|
+
import { writeFileSync, mkdirSync } from 'fs';
|
|
2
|
+
import { join, resolve } from 'path';
|
|
1
3
|
export const EXPORT_AGENT_JSON_TOOL = {
|
|
2
4
|
name: 'export_agent_json',
|
|
3
5
|
description: `Export the full agent configuration as clean, editable JSON.
|
|
4
6
|
|
|
5
7
|
Returns the complete agentConfig including identity, stages, connections (graph edges),
|
|
6
|
-
channelFlows, enabledTools, channels, and all other settings.
|
|
8
|
+
channelFlows, enabledTools, channels, widgetConfig, voice, and all other settings.
|
|
9
|
+
Also includes apiKey (read-only) for external integrations.
|
|
10
|
+
|
|
11
|
+
The exported JSON is automatically saved to a local file for easy editing:
|
|
12
|
+
- Default: saves to ./agents/{agent-name}.json in the current working directory
|
|
13
|
+
- Custom: use savePath to specify a different directory
|
|
7
14
|
|
|
8
15
|
Use import_agent_json to re-import after editing.`,
|
|
9
16
|
inputSchema: {
|
|
10
17
|
type: 'object',
|
|
11
18
|
properties: {
|
|
12
|
-
agentId: { type: 'string', description: 'The MongoDB ID of the agent to export' }
|
|
19
|
+
agentId: { type: 'string', description: 'The MongoDB ID of the agent to export' },
|
|
20
|
+
savePath: { type: 'string', description: 'Optional. Directory path where the JSON file will be saved. Default: ./agents/' }
|
|
13
21
|
},
|
|
14
22
|
required: ['agentId']
|
|
15
23
|
}
|
|
16
24
|
};
|
|
17
25
|
export async function exportAgentJsonHandler(client, args) {
|
|
18
26
|
const agentId = args.agentId;
|
|
19
|
-
|
|
27
|
+
const savePath = args.savePath || './agents';
|
|
28
|
+
const result = await client.get(`/api/v1/mcp/agents/${agentId}/export`);
|
|
29
|
+
// Auto-save to local file
|
|
30
|
+
if (result?.success && result?.data?.agentConfig) {
|
|
31
|
+
try {
|
|
32
|
+
const agentName = result.data.agentConfig.name || agentId;
|
|
33
|
+
// Sanitize filename: replace special chars, lowercase
|
|
34
|
+
const sanitizedName = agentName
|
|
35
|
+
.replace(/[^\w\s-]/g, '')
|
|
36
|
+
.replace(/\s+/g, '_')
|
|
37
|
+
.toLowerCase()
|
|
38
|
+
.substring(0, 50);
|
|
39
|
+
const fileName = `${sanitizedName}.json`;
|
|
40
|
+
const dir = resolve(savePath);
|
|
41
|
+
mkdirSync(dir, { recursive: true });
|
|
42
|
+
const filePath = join(dir, fileName);
|
|
43
|
+
const exportPayload = {
|
|
44
|
+
_exportedAt: new Date().toISOString(),
|
|
45
|
+
_agentId: result.data.agentId,
|
|
46
|
+
_apiKey: result.data.apiKey,
|
|
47
|
+
...result.data.agentConfig
|
|
48
|
+
};
|
|
49
|
+
writeFileSync(filePath, JSON.stringify(exportPayload, null, 2), 'utf-8');
|
|
50
|
+
result.savedTo = filePath;
|
|
51
|
+
result.message = `${result.message || ''} File saved to: ${filePath}`;
|
|
52
|
+
}
|
|
53
|
+
catch (err) {
|
|
54
|
+
result.fileSaveError = `Could not save file: ${err.message}`;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return result;
|
|
20
58
|
}
|
|
21
59
|
//# sourceMappingURL=export_agent_json.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"export_agent_json.js","sourceRoot":"","sources":["../../src/tools/export_agent_json.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AC,EAAE,EAAE,CAAC,CAAA;YACnB,MAAM,QAAQ,GAAG,GAAG,aAAa,OAAO,CAAA;YAExC,MAAM,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAA;YAC7B,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;YAEnC,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;YACpC,MAAM,aAAa,GAAG;gBACpB,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;gBACrC,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO;gBAC7B,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM;gBAC3B,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW;aAC3B,CAAA;YAED,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,CAAA;YAExE,MAAM,CAAC,OAAO,GAAG,QAAQ,CAAA;YACzB,MAAM,CAAC,OAAO,GAAG,GAAG,MAAM,CAAC,OAAO,IAAI,EAAE,mBAAmB,QAAQ,EAAE,CAAA;QACvE,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,MAAM,CAAC,aAAa,GAAG,wBAAwB,GAAG,CAAC,OAAO,EAAE,CAAA;QAC9D,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC"}
|
package/dist/tools/index.js
CHANGED
|
@@ -16,6 +16,7 @@ import { EXPORT_AGENT_JSON_TOOL, exportAgentJsonHandler } from './export_agent_j
|
|
|
16
16
|
import { IMPORT_AGENT_JSON_TOOL, importAgentJsonHandler } from './import_agent_json.js';
|
|
17
17
|
import { LIST_TEMPLATES_TOOL, listTemplatesHandler } from './list_templates.js';
|
|
18
18
|
import { CREATE_FROM_TEMPLATE_TOOL, createFromTemplateHandler } from './create_from_template.js';
|
|
19
|
+
import { EXAMPLE_AGENT_TOOL, exampleAgentHandler } from './example_agent.js';
|
|
19
20
|
export const ALL_TOOLS = [
|
|
20
21
|
LIST_AGENTS_TOOL,
|
|
21
22
|
GET_AGENT_TOOL,
|
|
@@ -31,6 +32,7 @@ export const ALL_TOOLS = [
|
|
|
31
32
|
IMPORT_AGENT_JSON_TOOL,
|
|
32
33
|
LIST_TEMPLATES_TOOL,
|
|
33
34
|
CREATE_FROM_TEMPLATE_TOOL,
|
|
35
|
+
EXAMPLE_AGENT_TOOL,
|
|
34
36
|
];
|
|
35
37
|
export const TOOL_HANDLERS = {
|
|
36
38
|
list_agents: listAgentsHandler,
|
|
@@ -47,5 +49,6 @@ export const TOOL_HANDLERS = {
|
|
|
47
49
|
import_agent_json: importAgentJsonHandler,
|
|
48
50
|
list_templates: listTemplatesHandler,
|
|
49
51
|
create_from_template: createFromTemplateHandler,
|
|
52
|
+
example_agent: exampleAgentHandler,
|
|
50
53
|
};
|
|
51
54
|
//# sourceMappingURL=index.js.map
|
package/dist/tools/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,8BAA8B;AAC9B,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AACtE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAChE,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAA;AACpF,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM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