@hostwebhook/node-types 1.86.0 → 1.88.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/dist/calendar-toolkit.d.ts +3 -0
- package/dist/calendar-toolkit.js +3 -2
- package/dist/clase-de-herramienta.d.ts +61 -0
- package/dist/clase-de-herramienta.js +153 -0
- package/dist/discord-toolkit.d.ts +2 -3
- package/dist/discord-toolkit.js +3 -6
- package/dist/docs-toolkit.d.ts +2 -1
- package/dist/docs-toolkit.js +3 -6
- package/dist/drive-toolkit.d.ts +9 -4
- package/dist/drive-toolkit.js +3 -4
- package/dist/esm/calendar-toolkit.d.ts +3 -0
- package/dist/esm/calendar-toolkit.js +3 -2
- package/dist/esm/clase-de-herramienta.d.ts +61 -0
- package/dist/esm/clase-de-herramienta.js +148 -0
- package/dist/esm/discord-toolkit.d.ts +2 -3
- package/dist/esm/discord-toolkit.js +3 -6
- package/dist/esm/docs-toolkit.d.ts +2 -1
- package/dist/esm/docs-toolkit.js +3 -6
- package/dist/esm/drive-toolkit.d.ts +9 -4
- package/dist/esm/drive-toolkit.js +3 -4
- package/dist/esm/gmail-operations.d.ts +2 -0
- package/dist/esm/gmail-operations.js +7 -6
- package/dist/esm/google-contacts-toolkit.d.ts +46 -0
- package/dist/esm/google-contacts-toolkit.js +180 -0
- package/dist/esm/index.d.ts +10 -0
- package/dist/esm/index.js +9 -0
- package/dist/esm/mongo-toolkit.d.ts +47 -0
- package/dist/esm/mongo-toolkit.js +98 -0
- package/dist/esm/postgres-toolkit.d.ts +52 -0
- package/dist/esm/postgres-toolkit.js +85 -0
- package/dist/esm/registry.js +10 -0
- package/dist/esm/sheets-toolkit.d.ts +2 -1
- package/dist/esm/sheets-toolkit.js +3 -6
- package/dist/esm/slack-toolkit.d.ts +2 -3
- package/dist/esm/slack-toolkit.js +3 -4
- package/dist/esm/telegram-toolkit.d.ts +3 -0
- package/dist/esm/telegram-toolkit.js +3 -2
- package/dist/esm/toolkits.d.ts +111 -0
- package/dist/esm/toolkits.js +178 -0
- package/dist/gmail-operations.d.ts +2 -0
- package/dist/gmail-operations.js +11 -10
- package/dist/google-contacts-toolkit.d.ts +46 -0
- package/dist/google-contacts-toolkit.js +183 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +32 -1
- package/dist/mongo-toolkit.d.ts +47 -0
- package/dist/mongo-toolkit.js +101 -0
- package/dist/postgres-toolkit.d.ts +52 -0
- package/dist/postgres-toolkit.js +88 -0
- package/dist/registry.js +10 -0
- package/dist/sheets-toolkit.d.ts +2 -1
- package/dist/sheets-toolkit.js +3 -6
- package/dist/slack-toolkit.d.ts +2 -3
- package/dist/slack-toolkit.js +3 -4
- package/dist/telegram-toolkit.d.ts +3 -0
- package/dist/telegram-toolkit.js +3 -2
- package/dist/toolkits.d.ts +111 -0
- package/dist/toolkits.js +190 -0
- package/package.json +1 -1
|
@@ -38,9 +38,8 @@ export interface DiscordToolkitSpec {
|
|
|
38
38
|
/** Descripción (más reglas de uso) que ve el LLM. */
|
|
39
39
|
description: string;
|
|
40
40
|
parameters: DiscordToolkitParameter[];
|
|
41
|
-
/**
|
|
42
|
-
*
|
|
43
|
-
* salvo que la llamada traiga confirmación explícita. */
|
|
41
|
+
/** Pisa o borra. Lo pone `marcarDestructivas` leyendo el verbo del
|
|
42
|
+
* nombre (ver `clase-de-herramienta.ts`), no se escribe a mano. */
|
|
44
43
|
destructive?: boolean;
|
|
45
44
|
}
|
|
46
45
|
export declare const DISCORD_TOOLKIT_SPECS: DiscordToolkitSpec[];
|
|
@@ -23,8 +23,9 @@
|
|
|
23
23
|
* y quien mire la lista de herramientas del servidor MCP.
|
|
24
24
|
*/
|
|
25
25
|
import { camposDeDiscordNoDisponibles, operacionesDeDiscordPara, } from './discord-operations.js';
|
|
26
|
+
import { marcarDestructivas } from './clase-de-herramienta.js';
|
|
26
27
|
const p = (name, description, required = true, type = 'string') => ({ name, type, description, required });
|
|
27
|
-
export const DISCORD_TOOLKIT_SPECS = [
|
|
28
|
+
export const DISCORD_TOOLKIT_SPECS = marcarDestructivas([
|
|
28
29
|
// ── Messages ───────────────────────────────────────────────────
|
|
29
30
|
{
|
|
30
31
|
operation: 'sendMessage',
|
|
@@ -63,7 +64,6 @@ export const DISCORD_TOOLKIT_SPECS = [
|
|
|
63
64
|
p('channelId', 'Channel snowflake where the message lives.'),
|
|
64
65
|
p('messageId', 'Snowflake of the message to delete.'),
|
|
65
66
|
],
|
|
66
|
-
destructive: true,
|
|
67
67
|
},
|
|
68
68
|
{
|
|
69
69
|
operation: 'getMessage',
|
|
@@ -149,7 +149,6 @@ export const DISCORD_TOOLKIT_SPECS = [
|
|
|
149
149
|
toolName: 'delete_discord_channel',
|
|
150
150
|
description: 'Permanently delete a Discord channel and ALL its messages. Irreversible. ALWAYS confirm with the user before calling — Discord does not provide a recovery window.',
|
|
151
151
|
parameters: [p('channelId', 'Channel snowflake to delete.')],
|
|
152
|
-
destructive: true,
|
|
153
152
|
},
|
|
154
153
|
{
|
|
155
154
|
operation: 'getChannel',
|
|
@@ -205,7 +204,6 @@ export const DISCORD_TOOLKIT_SPECS = [
|
|
|
205
204
|
p('userId', 'Member snowflake.'),
|
|
206
205
|
p('roleId', 'Role snowflake to grant.'),
|
|
207
206
|
],
|
|
208
|
-
destructive: true,
|
|
209
207
|
},
|
|
210
208
|
{
|
|
211
209
|
operation: 'removeRole',
|
|
@@ -217,7 +215,6 @@ export const DISCORD_TOOLKIT_SPECS = [
|
|
|
217
215
|
p('userId', 'Member snowflake.'),
|
|
218
216
|
p('roleId', 'Role snowflake to remove.'),
|
|
219
217
|
],
|
|
220
|
-
destructive: true,
|
|
221
218
|
},
|
|
222
219
|
{
|
|
223
220
|
operation: 'getMember',
|
|
@@ -229,7 +226,7 @@ export const DISCORD_TOOLKIT_SPECS = [
|
|
|
229
226
|
p('userId', 'Member snowflake.'),
|
|
230
227
|
],
|
|
231
228
|
},
|
|
232
|
-
];
|
|
229
|
+
]);
|
|
233
230
|
export const DISCORD_TOOLKIT_BY_TOOL_NAME = Object.fromEntries(DISCORD_TOOLKIT_SPECS.map((s) => [s.toolName, s]));
|
|
234
231
|
/**
|
|
235
232
|
* Las herramientas que ofrecerle al modelo con ESTA credencial.
|
|
@@ -27,7 +27,8 @@ export interface DocsToolkitSpec {
|
|
|
27
27
|
toolName: string;
|
|
28
28
|
description: string;
|
|
29
29
|
parameters: DocsToolkitParameter[];
|
|
30
|
-
/**
|
|
30
|
+
/** Pisa o borra. Lo pone `marcarDestructivas` leyendo el verbo del
|
|
31
|
+
* nombre (ver `clase-de-herramienta.ts`), no se escribe a mano. */
|
|
31
32
|
destructive?: boolean;
|
|
32
33
|
}
|
|
33
34
|
export declare const DOCS_TOOLKIT_SPECS: DocsToolkitSpec[];
|
package/dist/esm/docs-toolkit.js
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* usarse sin adaptador. Los textos van en inglés porque los lee el modelo y
|
|
14
14
|
* quien mire la lista de herramientas del servidor MCP.
|
|
15
15
|
*/
|
|
16
|
+
import { marcarDestructivas } from './clase-de-herramienta.js';
|
|
16
17
|
const p = (name, description, required = true, type = 'string') => ({ name, type, description, required });
|
|
17
18
|
/*
|
|
18
19
|
* El documento del nodo va como **defecto** y el modelo puede cambiarlo — la
|
|
@@ -31,7 +32,7 @@ const p = (name, description, required = true, type = 'string') => ({ name, type
|
|
|
31
32
|
* documento nuevo nacería con el id del viejo por título.
|
|
32
33
|
*/
|
|
33
34
|
const documento = () => p('documentId', 'Id of the Google Docs document — the long chunk of its URL, between /d/ and /edit.');
|
|
34
|
-
export const DOCS_TOOLKIT_SPECS = [
|
|
35
|
+
export const DOCS_TOOLKIT_SPECS = marcarDestructivas([
|
|
35
36
|
{
|
|
36
37
|
operation: 'readDoc',
|
|
37
38
|
label: 'Read document',
|
|
@@ -48,7 +49,6 @@ export const DOCS_TOOLKIT_SPECS = [
|
|
|
48
49
|
p('title', 'Name of the new document.'),
|
|
49
50
|
p('content', 'Initial body, as HTML. Basic tags work (<p>, <b>, <i>, <ul>, <li>, <h1>…). Plain text is fine too. Leave it out for an empty document.', false),
|
|
50
51
|
],
|
|
51
|
-
destructive: true,
|
|
52
52
|
},
|
|
53
53
|
{
|
|
54
54
|
operation: 'appendText',
|
|
@@ -59,7 +59,6 @@ export const DOCS_TOOLKIT_SPECS = [
|
|
|
59
59
|
p('content', 'What to add, as HTML. Basic tags work (<p>, <b>, <i>, <ul>, <li>, <h1>…). Plain text is fine too.'),
|
|
60
60
|
documento(),
|
|
61
61
|
],
|
|
62
|
-
destructive: true,
|
|
63
62
|
},
|
|
64
63
|
{
|
|
65
64
|
operation: 'replaceText',
|
|
@@ -71,7 +70,6 @@ export const DOCS_TOOLKIT_SPECS = [
|
|
|
71
70
|
p('replaceWith', 'Text to put in its place. An empty string deletes the matches.'),
|
|
72
71
|
documento(),
|
|
73
72
|
],
|
|
74
|
-
destructive: true,
|
|
75
73
|
},
|
|
76
74
|
{
|
|
77
75
|
operation: 'insertTable',
|
|
@@ -83,9 +81,8 @@ export const DOCS_TOOLKIT_SPECS = [
|
|
|
83
81
|
p('cols', 'Number of columns.', true, 'number'),
|
|
84
82
|
documento(),
|
|
85
83
|
],
|
|
86
|
-
destructive: true,
|
|
87
84
|
},
|
|
88
|
-
];
|
|
85
|
+
]);
|
|
89
86
|
/** Las herramientas por nombre, para despachar una llamada del modelo. */
|
|
90
87
|
export const DOCS_TOOLKIT_BY_TOOL_NAME = Object.fromEntries(DOCS_TOOLKIT_SPECS.map((s) => [s.toolName, s]));
|
|
91
88
|
/**
|
|
@@ -42,10 +42,15 @@ export interface DriveToolkitSpec {
|
|
|
42
42
|
/** Encabezado de grupo de la página de detalle. El orden es el que agrupa. */
|
|
43
43
|
group?: string;
|
|
44
44
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
45
|
+
* Pisa o borra. Lo pone `marcarDestructivas` leyendo el verbo del nombre
|
|
46
|
+
* (ver `clase-de-herramienta.ts`), no se escribe a mano.
|
|
47
|
+
*
|
|
48
|
+
* ⚠️ Hasta el 2026-09-24 aquí se decía que `move` no lo llevaba —«deshacerlo
|
|
49
|
+
* es otro move»—, mientras la tabla de anotaciones MCP de la api decía lo
|
|
50
|
+
* contrario: sacar el fichero de su carpeta es quitarlo de donde estaba. Eran
|
|
51
|
+
* dos criterios para lo mismo; se queda el de la tabla, que es el único que
|
|
52
|
+
* estaba escrito como regla. `share_drive_file` sigue marcada, ahora como
|
|
53
|
+
* excepción explícita: compartir expone, y eso no se deshace.
|
|
49
54
|
*/
|
|
50
55
|
destructive?: boolean;
|
|
51
56
|
}
|
|
@@ -19,11 +19,12 @@
|
|
|
19
19
|
* herramientas del mismo grupo tienen que ir seguidas. Los tres grupos son los
|
|
20
20
|
* que ya inventaba el JSX que sustituye.
|
|
21
21
|
*/
|
|
22
|
+
import { marcarDestructivas } from './clase-de-herramienta.js';
|
|
22
23
|
const p = (name, description, required = true, type = 'string') => ({ name, type, description, required });
|
|
23
24
|
const ENTRAN_Y_SALEN = 'Files in / out';
|
|
24
25
|
const DESCUBRIR = 'Discovery';
|
|
25
26
|
const MUTACIONES = 'Mutations (LLM confirms first)';
|
|
26
|
-
export const DRIVE_TOOLKIT_SPECS = [
|
|
27
|
+
export const DRIVE_TOOLKIT_SPECS = marcarDestructivas([
|
|
27
28
|
/* ── Files in / out ─────────────────────────────────────────────────── */
|
|
28
29
|
{
|
|
29
30
|
operation: 'upload',
|
|
@@ -154,7 +155,6 @@ export const DRIVE_TOOLKIT_SPECS = [
|
|
|
154
155
|
p('fileId', 'The Drive file ID to delete.'),
|
|
155
156
|
p('permanent', 'Optional. true = bypass trash and erase forever (irreversible). Default false.', false, 'boolean'),
|
|
156
157
|
],
|
|
157
|
-
destructive: true,
|
|
158
158
|
},
|
|
159
159
|
{
|
|
160
160
|
operation: 'share',
|
|
@@ -170,8 +170,7 @@ export const DRIVE_TOOLKIT_SPECS = [
|
|
|
170
170
|
p('domain', 'Required when type=domain.', false),
|
|
171
171
|
p('sendNotificationEmail', 'Optional. true = email the recipient about the share.', false, 'boolean'),
|
|
172
172
|
],
|
|
173
|
-
destructive: true,
|
|
174
173
|
},
|
|
175
|
-
];
|
|
174
|
+
]);
|
|
176
175
|
/** Índice por nombre de herramienta, para enrutar un `tools/call` sin recorrer. */
|
|
177
176
|
export const DRIVE_TOOLKIT_BY_TOOL_NAME = Object.fromEntries(DRIVE_TOOLKIT_SPECS.map((s) => [s.toolName, s]));
|
|
@@ -151,6 +151,8 @@ export interface GmailToolkitSpec {
|
|
|
151
151
|
toolName: string;
|
|
152
152
|
description: string;
|
|
153
153
|
parameters: GmailToolkitParameter[];
|
|
154
|
+
/** Pisa o borra. Lo pone `marcarDestructivas` leyendo el verbo del
|
|
155
|
+
* nombre (ver `clase-de-herramienta.ts`), no se escribe a mano. */
|
|
154
156
|
destructive?: boolean;
|
|
155
157
|
}
|
|
156
158
|
export declare const GMAIL_TOOLKIT_SPECS: GmailToolkitSpec[];
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* dashboard owns the UI form schema, the api owns the dispatch logic),
|
|
13
13
|
* but the canonical list of valid operation strings lives here.
|
|
14
14
|
*/
|
|
15
|
+
import { marcarDestructivas } from './clase-de-herramienta.js';
|
|
15
16
|
export const GMAIL_OPERATIONS = [
|
|
16
17
|
'send',
|
|
17
18
|
// Pause-the-pipeline op — sends an email with Approve / (optional)
|
|
@@ -296,7 +297,7 @@ const p = (name, description, required = true, type = 'string') => ({ name, type
|
|
|
296
297
|
const ADJUNTOS = p('attachments', 'Optional. Files to attach, taken from the payload: pass the `_file` reference object(s) ' +
|
|
297
298
|
'exactly as they appear (a single `_file`, or the `_files` / `files` array), as a JSON ' +
|
|
298
299
|
'string. Never invent one. Up to 5 files, 25 MB in total.', false);
|
|
299
|
-
export const GMAIL_TOOLKIT_SPECS = [
|
|
300
|
+
export const GMAIL_TOOLKIT_SPECS = marcarDestructivas([
|
|
300
301
|
{
|
|
301
302
|
operation: 'send',
|
|
302
303
|
label: 'Send message',
|
|
@@ -505,7 +506,7 @@ export const GMAIL_TOOLKIT_SPECS = [
|
|
|
505
506
|
p('threadId', 'Gmail thread id.'),
|
|
506
507
|
],
|
|
507
508
|
},
|
|
508
|
-
];
|
|
509
|
+
]);
|
|
509
510
|
/**
|
|
510
511
|
* La op que espera, **fuera** del toolkit y aparte a propósito. Sigue haciendo
|
|
511
512
|
* falta para dos cosas que no son el toolkit: reconocer la operación de una
|
|
@@ -535,12 +536,12 @@ export const GMAIL_SEND_AND_WAIT_TOOL_SPEC = {
|
|
|
535
536
|
],
|
|
536
537
|
};
|
|
537
538
|
/** Todo lo que el nodo sabe ejecutar, se ofrezca o no como herramienta. */
|
|
538
|
-
export const GMAIL_ALL_TOOLKIT_SPECS = [
|
|
539
|
+
export const GMAIL_ALL_TOOLKIT_SPECS = marcarDestructivas([
|
|
539
540
|
...GMAIL_TOOLKIT_SPECS,
|
|
540
541
|
GMAIL_SEND_AND_WAIT_TOOL_SPEC,
|
|
541
|
-
];
|
|
542
|
+
]);
|
|
542
543
|
/** El toolkit del proveedor nativo (Resend): una sola herramienta. */
|
|
543
|
-
export const NATIVE_EMAIL_TOOLKIT_SPECS = [
|
|
544
|
+
export const NATIVE_EMAIL_TOOLKIT_SPECS = marcarDestructivas([
|
|
544
545
|
{
|
|
545
546
|
operation: 'send',
|
|
546
547
|
label: 'Send email',
|
|
@@ -559,7 +560,7 @@ export const NATIVE_EMAIL_TOOLKIT_SPECS = [
|
|
|
559
560
|
p('attachment_file_ids', 'Optional. Comma-separated list of file IDs from `_file.id` refs in the upstream payload (e.g., a File Transform output or a webhook multipart upload). Max 5 files, 30MB total. Do NOT invent IDs — only use values actually present in the current payload.', false),
|
|
560
561
|
],
|
|
561
562
|
},
|
|
562
|
-
];
|
|
563
|
+
]);
|
|
563
564
|
export const GMAIL_TOOLKIT_BY_TOOL_NAME = Object.fromEntries(GMAIL_ALL_TOOLKIT_SPECS.map((s) => [s.toolName, s]));
|
|
564
565
|
export const NATIVE_EMAIL_TOOLKIT_BY_TOOL_NAME = Object.fromEntries(NATIVE_EMAIL_TOOLKIT_SPECS.map((s) => [s.toolName, s]));
|
|
565
566
|
/** Los tres campos que un día vivieron en la raíz. */
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Google Contacts AI Toolkit — las herramientas que un googleContactsAction
|
|
3
|
+
* expone cuando `aiEnabled` está encendido.
|
|
4
|
+
*
|
|
5
|
+
* **Se escribe una sola vez** (2026-09-24). Vivía dos veces: en
|
|
6
|
+
* `api/src/mcp-servers/toolkit-specs.ts` y en
|
|
7
|
+
* `dashboard/components/google-contacts-actions/google-contacts-operations-schemas.ts`,
|
|
8
|
+
* las dos a mano. Al mudarlas coincidían exactamente —las 15 operaciones, sus
|
|
9
|
+
* nombres, textos y parámetros—; el `group` del dashboard ya lo lleva el spec
|
|
10
|
+
* de formulario (`GOOGLE_CONTACTS_OPERATION_SPECS[op].group`).
|
|
11
|
+
*
|
|
12
|
+
* Se llama `GOOGLE_CONTACTS_TOOLKIT_SPECS` y no `…_OPERATION_SPECS` porque ese
|
|
13
|
+
* nombre ya es el del FORMULARIO del nodo en este paquete — la misma pareja que
|
|
14
|
+
* Discord y Slack.
|
|
15
|
+
*
|
|
16
|
+
* ⚠️ El `destructive` ya no se escribe a mano: lo pone `marcarDestructivas` por
|
|
17
|
+
* el verbo. Cuatro que la copia vieja marcaba dejan de serlo —crear o añadir no
|
|
18
|
+
* pisa nada—: `create_contact`, `add_contact_to_group`,
|
|
19
|
+
* `batch_create_contacts` y `create_contact_group`. El gate del AI Node ya las
|
|
20
|
+
* leía así (por el verbo del nombre); lo que cambia es la etiqueta del panel.
|
|
21
|
+
*
|
|
22
|
+
* Los textos van en inglés porque los lee el modelo.
|
|
23
|
+
*/
|
|
24
|
+
import type { GoogleContactsOperation } from './google-contacts-operations.js';
|
|
25
|
+
export interface GoogleContactsToolkitParameter {
|
|
26
|
+
name: string;
|
|
27
|
+
type: 'string' | 'number' | 'boolean';
|
|
28
|
+
description: string;
|
|
29
|
+
required: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface GoogleContactsToolkitSpec {
|
|
32
|
+
operation: GoogleContactsOperation;
|
|
33
|
+
/** Etiqueta corta de la fila en la lista de herramientas. */
|
|
34
|
+
label: string;
|
|
35
|
+
/** Nombre con el que el LLM llama a la herramienta. */
|
|
36
|
+
toolName: string;
|
|
37
|
+
/** Descripción (más reglas de uso) que ve el LLM. */
|
|
38
|
+
description: string;
|
|
39
|
+
parameters: GoogleContactsToolkitParameter[];
|
|
40
|
+
/** Pisa o borra. Lo pone `marcarDestructivas` leyendo el verbo del
|
|
41
|
+
* nombre (ver `clase-de-herramienta.ts`), no se escribe a mano. */
|
|
42
|
+
destructive?: boolean;
|
|
43
|
+
}
|
|
44
|
+
export declare const GOOGLE_CONTACTS_TOOLKIT_SPECS: GoogleContactsToolkitSpec[];
|
|
45
|
+
/** Las herramientas por nombre, para despachar una llamada del modelo. */
|
|
46
|
+
export declare const GOOGLE_CONTACTS_TOOLKIT_BY_TOOL_NAME: Record<string, GoogleContactsToolkitSpec>;
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Google Contacts AI Toolkit — las herramientas que un googleContactsAction
|
|
3
|
+
* expone cuando `aiEnabled` está encendido.
|
|
4
|
+
*
|
|
5
|
+
* **Se escribe una sola vez** (2026-09-24). Vivía dos veces: en
|
|
6
|
+
* `api/src/mcp-servers/toolkit-specs.ts` y en
|
|
7
|
+
* `dashboard/components/google-contacts-actions/google-contacts-operations-schemas.ts`,
|
|
8
|
+
* las dos a mano. Al mudarlas coincidían exactamente —las 15 operaciones, sus
|
|
9
|
+
* nombres, textos y parámetros—; el `group` del dashboard ya lo lleva el spec
|
|
10
|
+
* de formulario (`GOOGLE_CONTACTS_OPERATION_SPECS[op].group`).
|
|
11
|
+
*
|
|
12
|
+
* Se llama `GOOGLE_CONTACTS_TOOLKIT_SPECS` y no `…_OPERATION_SPECS` porque ese
|
|
13
|
+
* nombre ya es el del FORMULARIO del nodo en este paquete — la misma pareja que
|
|
14
|
+
* Discord y Slack.
|
|
15
|
+
*
|
|
16
|
+
* ⚠️ El `destructive` ya no se escribe a mano: lo pone `marcarDestructivas` por
|
|
17
|
+
* el verbo. Cuatro que la copia vieja marcaba dejan de serlo —crear o añadir no
|
|
18
|
+
* pisa nada—: `create_contact`, `add_contact_to_group`,
|
|
19
|
+
* `batch_create_contacts` y `create_contact_group`. El gate del AI Node ya las
|
|
20
|
+
* leía así (por el verbo del nombre); lo que cambia es la etiqueta del panel.
|
|
21
|
+
*
|
|
22
|
+
* Los textos van en inglés porque los lee el modelo.
|
|
23
|
+
*/
|
|
24
|
+
import { marcarDestructivas } from './clase-de-herramienta.js';
|
|
25
|
+
const p = (name, description, required = true, type = 'string') => ({ name, type, description, required });
|
|
26
|
+
export const GOOGLE_CONTACTS_TOOLKIT_SPECS = marcarDestructivas([
|
|
27
|
+
// ── Read ─────────────────────────────────────────────────────────
|
|
28
|
+
{
|
|
29
|
+
operation: 'searchContacts',
|
|
30
|
+
label: 'Search contacts',
|
|
31
|
+
toolName: 'search_contacts',
|
|
32
|
+
description: "Free-text search across the user's contacts. Matches names, emails, phones, and organization. Use this BEFORE updateContact / deleteContact / addContactToGroup when the user references a contact by name or email — never invent a resourceName.",
|
|
33
|
+
parameters: [
|
|
34
|
+
p('query', 'Free-text query (name fragment, email, phone, organization).'),
|
|
35
|
+
p('pageSize', 'Max results (default 30, hard cap 30).', false, 'number'),
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
operation: 'listContacts',
|
|
40
|
+
label: 'List contacts',
|
|
41
|
+
toolName: 'list_contacts',
|
|
42
|
+
description: 'Paginated list of every contact. Prefer searchContacts for name/email lookup — listContacts returns hundreds of rows even when the user named one.',
|
|
43
|
+
parameters: [
|
|
44
|
+
p('pageSize', 'Page size (default 100, max 1000).', false, 'number'),
|
|
45
|
+
p('pageToken', 'Token returned by previous listContacts. Empty for first page.', false),
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
operation: 'getContact',
|
|
50
|
+
label: 'Get contact',
|
|
51
|
+
toolName: 'get_contact',
|
|
52
|
+
description: 'Fetch a single contact by resourceName. Use AFTER searchContacts to read the full record before updating.',
|
|
53
|
+
parameters: [
|
|
54
|
+
p('resourceName', 'People API id, e.g. "people/c12345". Get from searchContacts results.'),
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
// ── Write ────────────────────────────────────────────────────────
|
|
58
|
+
{
|
|
59
|
+
operation: 'createContact',
|
|
60
|
+
label: 'Create contact',
|
|
61
|
+
toolName: 'create_contact',
|
|
62
|
+
description: "Add a new contact to the user's address book. NEVER call this without confirming with the user first — duplicate contacts are messy to clean up. Pass `fullName` and the helper auto-splits given/family. Pass `emailAddresses` and `phoneNumbers` as arrays of strings.",
|
|
63
|
+
parameters: [
|
|
64
|
+
p('fullName', 'Full name (e.g. "Ariel Pérez"). Auto-splits to given + family.', false),
|
|
65
|
+
p('givenName', 'First name. Overrides the fullName split.', false),
|
|
66
|
+
p('familyName', 'Last name. Overrides the fullName split.', false),
|
|
67
|
+
p('emailAddresses', 'Array of email addresses. JSON-encode if your tool layer expects a string.', false),
|
|
68
|
+
p('phoneNumbers', 'Array of phone numbers.', false),
|
|
69
|
+
p('notes', 'Free-form note attached to the contact.', false),
|
|
70
|
+
],
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
operation: 'updateContact',
|
|
74
|
+
label: 'Update contact',
|
|
75
|
+
toolName: 'update_contact',
|
|
76
|
+
description: "Change fields on an existing contact. Get the resourceName from searchContacts first. Update mask is auto-derived from the fields you pass — only include fields you want changed (passing `notes` won't blank out the email).",
|
|
77
|
+
parameters: [
|
|
78
|
+
p('resourceName', 'People API id, e.g. "people/c12345".'),
|
|
79
|
+
p('fullName', 'New full name (auto-splits).', false),
|
|
80
|
+
p('emailAddresses', 'Replace email list. Pass [] to clear.', false),
|
|
81
|
+
p('phoneNumbers', 'Replace phone list.', false),
|
|
82
|
+
p('notes', "Replace the contact's note.", false),
|
|
83
|
+
],
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
operation: 'deleteContact',
|
|
87
|
+
label: 'Delete contact',
|
|
88
|
+
toolName: 'delete_contact',
|
|
89
|
+
description: 'Permanently remove a contact. Irreversible. ALWAYS confirm with the user before calling. Use searchContacts first to verify you have the right resourceName.',
|
|
90
|
+
parameters: [p('resourceName', 'People API id of the contact to delete.')],
|
|
91
|
+
},
|
|
92
|
+
// ── Groups ───────────────────────────────────────────────────────
|
|
93
|
+
{
|
|
94
|
+
operation: 'listContactGroups',
|
|
95
|
+
label: 'List groups',
|
|
96
|
+
toolName: 'list_contact_groups',
|
|
97
|
+
description: "List the user's contact groups (labels). Call this BEFORE addContactToGroup / removeContactFromGroup so you have the right groupResourceName.",
|
|
98
|
+
parameters: [
|
|
99
|
+
p('pageSize', 'Page size (default 200, max 1000).', false, 'number'),
|
|
100
|
+
],
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
operation: 'addContactToGroup',
|
|
104
|
+
label: 'Add to group',
|
|
105
|
+
toolName: 'add_contact_to_group',
|
|
106
|
+
description: 'Add a contact to a group (label). Idempotent — no error if the contact is already in the group. Get the groupResourceName from listContactGroups.',
|
|
107
|
+
parameters: [
|
|
108
|
+
p('resourceName', 'Contact id, e.g. "people/c12345". Or array of contact ids.'),
|
|
109
|
+
p('groupResourceName', 'Group id, e.g. "contactGroups/12345".'),
|
|
110
|
+
],
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
operation: 'removeContactFromGroup',
|
|
114
|
+
label: 'Remove from group',
|
|
115
|
+
toolName: 'remove_contact_from_group',
|
|
116
|
+
description: 'Remove a contact from a group. Idempotent. Does NOT delete the contact, only its membership in that group.',
|
|
117
|
+
parameters: [
|
|
118
|
+
p('resourceName', 'Contact id, e.g. "people/c12345".'),
|
|
119
|
+
p('groupResourceName', 'Group id, e.g. "contactGroups/12345".'),
|
|
120
|
+
],
|
|
121
|
+
},
|
|
122
|
+
// ── V2 — bulk + group management ─────────────────────────────────
|
|
123
|
+
{
|
|
124
|
+
operation: 'batchCreateContacts',
|
|
125
|
+
label: 'Batch create contacts',
|
|
126
|
+
toolName: 'batch_create_contacts',
|
|
127
|
+
description: 'Bulk-create up to 200 contacts in one call. Each contact in the array uses the same shape as createContact (fullName / emailAddresses / phoneNumbers / notes / etc.).',
|
|
128
|
+
parameters: [
|
|
129
|
+
p('contacts', 'Array of contact objects. Same shape as createContact.', true),
|
|
130
|
+
],
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
operation: 'batchUpdateContacts',
|
|
134
|
+
label: 'Batch update contacts',
|
|
135
|
+
toolName: 'batch_update_contacts',
|
|
136
|
+
description: 'Bulk-update up to 200 existing contacts. Each entry must include `resourceName`. Pass `updateMask` (e.g. "names,emailAddresses") to control which fields the API replaces.',
|
|
137
|
+
parameters: [
|
|
138
|
+
p('contacts', 'Array of {resourceName, ...fields} objects.', true),
|
|
139
|
+
p('updateMask', 'Comma-separated People API field paths to replace.'),
|
|
140
|
+
],
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
operation: 'batchDeleteContacts',
|
|
144
|
+
label: 'Batch delete contacts',
|
|
145
|
+
toolName: 'batch_delete_contacts',
|
|
146
|
+
description: 'Bulk-delete up to 500 contacts by resourceName. Irreversible.',
|
|
147
|
+
parameters: [
|
|
148
|
+
p('resourceNames', 'Array of People API ids, each like "people/c12345".'),
|
|
149
|
+
],
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
operation: 'createContactGroup',
|
|
153
|
+
label: 'Create group',
|
|
154
|
+
toolName: 'create_contact_group',
|
|
155
|
+
description: 'Create a new contact group (label).',
|
|
156
|
+
parameters: [p('name', 'Group name as displayed in Contacts.')],
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
operation: 'updateContactGroup',
|
|
160
|
+
label: 'Rename group',
|
|
161
|
+
toolName: 'update_contact_group',
|
|
162
|
+
description: 'Rename an existing contact group.',
|
|
163
|
+
parameters: [
|
|
164
|
+
p('resourceName', 'Group id, e.g. "contactGroups/12345".'),
|
|
165
|
+
p('name', 'New name for the group.'),
|
|
166
|
+
],
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
operation: 'deleteContactGroup',
|
|
170
|
+
label: 'Delete group',
|
|
171
|
+
toolName: 'delete_contact_group',
|
|
172
|
+
description: 'Delete a contact group. Pass `deleteContacts: true` to also delete the contacts in the group (otherwise contacts stay, just lose this membership). Irreversible — confirm with the user before calling.',
|
|
173
|
+
parameters: [
|
|
174
|
+
p('resourceName', 'Group id, e.g. "contactGroups/12345".'),
|
|
175
|
+
p('deleteContacts', 'When true, also delete contacts in the group. Default false.', false, 'boolean'),
|
|
176
|
+
],
|
|
177
|
+
},
|
|
178
|
+
]);
|
|
179
|
+
/** Las herramientas por nombre, para despachar una llamada del modelo. */
|
|
180
|
+
export const GOOGLE_CONTACTS_TOOLKIT_BY_TOOL_NAME = Object.fromEntries(GOOGLE_CONTACTS_TOOLKIT_SPECS.map((s) => [s.toolName, s]));
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -70,6 +70,16 @@ export { DOCS_OPERATIONS, DOCS_OPERATION_SPECS, isDocsOperation, } from './docs-
|
|
|
70
70
|
export type { DocsOperation, DocsParamType, DocsParamSlot, DocsParamSpec, DocsOperationSpec, } from './docs-operations.js';
|
|
71
71
|
export { DOCS_TOOLKIT_SPECS, DOCS_TOOLKIT_BY_TOOL_NAME, DOCS_TOOLKIT_DEFAULTABLE, } from './docs-toolkit.js';
|
|
72
72
|
export type { DocsToolkitSpec, DocsToolkitParameter, } from './docs-toolkit.js';
|
|
73
|
+
export { MONGO_TOOLKIT_SPECS, MONGO_TOOLKIT_BY_TOOL_NAME, } from './mongo-toolkit.js';
|
|
74
|
+
export type { MongoToolkitSpec, MongoToolkitParameter, } from './mongo-toolkit.js';
|
|
75
|
+
export { POSTGRES_TOOLKIT_SPECS, POSTGRES_TOOLKIT_BY_TOOL_NAME, } from './postgres-toolkit.js';
|
|
76
|
+
export type { PostgresToolkitSpec, PostgresToolkitParameter, } from './postgres-toolkit.js';
|
|
77
|
+
export { claseDeHerramienta, esHerramientaDestructiva, marcarDestructivas, } from './clase-de-herramienta.js';
|
|
78
|
+
export type { ClaseDeHerramienta } from './clase-de-herramienta.js';
|
|
79
|
+
export { TOOLKITS_POR_TIPO, operacionDeToolkit, esOperacionDestructiva, TIPOS_CON_TOOLKIT, tieneModoToolkit, admiteBloqueo, nombresDeHerramientas, bloqueadasDe, herramientaBloqueadaEn, MENSAJE_SIN_HERRAMIENTA, mensajeDeHerramientaBloqueada, motivoParaNoCorrer, } from './toolkits.js';
|
|
80
|
+
export { GOOGLE_CONTACTS_TOOLKIT_SPECS, GOOGLE_CONTACTS_TOOLKIT_BY_TOOL_NAME, } from './google-contacts-toolkit.js';
|
|
81
|
+
export type { GoogleContactsToolkitSpec, GoogleContactsToolkitParameter, } from './google-contacts-toolkit.js';
|
|
82
|
+
export type { OperacionDeToolkit } from './toolkits.js';
|
|
73
83
|
export type { LlmProvider, LlmProviderOption, LlmModelOption, } from './llm-models.js';
|
|
74
84
|
export { LLM_PROVIDERS, LLM_MODELS, MODEL_CONTEXT_WINDOWS, getModelsFor, getDefaultModel, getModelLabel, } from './llm-models.js';
|
|
75
85
|
export type { ModeloDeOpenRouter, PrecioDeOpenRouter, RespuestaDeModelosDeOpenRouter, } from './openrouter.js';
|
package/dist/esm/index.js
CHANGED
|
@@ -53,6 +53,15 @@ export { POSTGRES_OPERATIONS, POSTGRES_MODES, POSTGRES_OPERATION_SPECS, isPostgr
|
|
|
53
53
|
export { MONGO_OPERATIONS, MONGO_OPERATION_SPECS, isMongoOperation, } from './mongo-operations.js';
|
|
54
54
|
export { DOCS_OPERATIONS, DOCS_OPERATION_SPECS, isDocsOperation, } from './docs-operations.js';
|
|
55
55
|
export { DOCS_TOOLKIT_SPECS, DOCS_TOOLKIT_BY_TOOL_NAME, DOCS_TOOLKIT_DEFAULTABLE, } from './docs-toolkit.js';
|
|
56
|
+
// ── Toolkits de bases de datos, y la clase de cada herramienta (2026-09-24) ──
|
|
57
|
+
export { MONGO_TOOLKIT_SPECS, MONGO_TOOLKIT_BY_TOOL_NAME, } from './mongo-toolkit.js';
|
|
58
|
+
export { POSTGRES_TOOLKIT_SPECS, POSTGRES_TOOLKIT_BY_TOOL_NAME, } from './postgres-toolkit.js';
|
|
59
|
+
export { claseDeHerramienta, esHerramientaDestructiva, marcarDestructivas, } from './clase-de-herramienta.js';
|
|
60
|
+
export { TOOLKITS_POR_TIPO, operacionDeToolkit, esOperacionDestructiva, TIPOS_CON_TOOLKIT, tieneModoToolkit, admiteBloqueo, nombresDeHerramientas, bloqueadasDe, herramientaBloqueadaEn, MENSAJE_SIN_HERRAMIENTA, mensajeDeHerramientaBloqueada, motivoParaNoCorrer, } from './toolkits.js';
|
|
61
|
+
/* Contacts se escribía a mano en la api y en el dashboard; ahora una vez. Se
|
|
62
|
+
llama `…_TOOLKIT_SPECS` porque `GOOGLE_CONTACTS_OPERATION_SPECS` ya es el
|
|
63
|
+
formulario del nodo — la misma pareja que Discord y Slack. */
|
|
64
|
+
export { GOOGLE_CONTACTS_TOOLKIT_SPECS, GOOGLE_CONTACTS_TOOLKIT_BY_TOOL_NAME, } from './google-contacts-toolkit.js';
|
|
56
65
|
export { LLM_PROVIDERS, LLM_MODELS, MODEL_CONTEXT_WINDOWS, getModelsFor, getDefaultModel, getModelLabel, } from './llm-models.js';
|
|
57
66
|
export { URL_DE_MODELOS_DE_OPENROUTER, opcionesDeModelosDeOpenRouter, ventanaDeContextoDeOpenRouter, } from './openrouter.js';
|
|
58
67
|
export { CREDENTIAL_TYPES, CREDENTIAL_TYPE_VALUES, credentialTypeValues, getCredentialType, isCredentialType, } from './credentials.js';
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MongoDB AI Toolkit — las herramientas que un mongoAction expone cuando
|
|
3
|
+
* `aiEnabled` está encendido.
|
|
4
|
+
*
|
|
5
|
+
* ## Lo que el modelo NO elige (2026-09-24, decisiones de Ariel)
|
|
6
|
+
*
|
|
7
|
+
* - **La colección.** Es la del nodo y no hay parámetro para cambiarla: para
|
|
8
|
+
* tocar otra se conecta otro nodo. Una herramienta de base de datos que deja
|
|
9
|
+
* al modelo nombrar la colección le da acceso a todo lo que la credencial
|
|
10
|
+
* alcanza, y eso no se ve al mirar el lienzo.
|
|
11
|
+
* - **El JavaScript del servidor.** `$where`, `$function` y `$accumulator`
|
|
12
|
+
* ejecutan código dentro de Mongo; el handler los rechaza en cualquier
|
|
13
|
+
* filtro o pipeline que venga del modelo.
|
|
14
|
+
* - **Escribir desde una agregación.** `$out` y `$merge` son las dos etapas que
|
|
15
|
+
* escriben; `aggregate_documents` las rechaza, y por eso cuenta como lectura.
|
|
16
|
+
*
|
|
17
|
+
* ## Los nombres
|
|
18
|
+
*
|
|
19
|
+
* Cada nombre empieza por el verbo que dice lo que hace, porque el `destructive`
|
|
20
|
+
* de cada operación lo pone `marcarDestructivas` leyendo ese verbo (ver
|
|
21
|
+
* `clase-de-herramienta.ts`). Por eso `findOneAndUpdate` se ofrece como
|
|
22
|
+
* `update_and_return_document` y no como `find_and_update_document`: con el
|
|
23
|
+
* segundo nombre el verbo diría «lectura» de algo que pisa un documento.
|
|
24
|
+
*
|
|
25
|
+
* Los textos van en inglés porque los lee el modelo.
|
|
26
|
+
*/
|
|
27
|
+
import type { MongoOperation } from './mongo-operations';
|
|
28
|
+
export interface MongoToolkitParameter {
|
|
29
|
+
name: string;
|
|
30
|
+
/** El esquema MCP sólo admite estos tres; lo estructurado viaja como JSON
|
|
31
|
+
* en un `string`, igual que las filas de Sheets. */
|
|
32
|
+
type: 'string' | 'number' | 'boolean';
|
|
33
|
+
description: string;
|
|
34
|
+
required: boolean;
|
|
35
|
+
}
|
|
36
|
+
export interface MongoToolkitSpec {
|
|
37
|
+
operation: MongoOperation;
|
|
38
|
+
label: string;
|
|
39
|
+
toolName: string;
|
|
40
|
+
description: string;
|
|
41
|
+
parameters: MongoToolkitParameter[];
|
|
42
|
+
/** Pisa o borra. Lo pone `marcarDestructivas`, no se escribe a mano. */
|
|
43
|
+
destructive?: boolean;
|
|
44
|
+
}
|
|
45
|
+
export declare const MONGO_TOOLKIT_SPECS: MongoToolkitSpec[];
|
|
46
|
+
/** Las herramientas por nombre, para despachar una llamada del modelo. */
|
|
47
|
+
export declare const MONGO_TOOLKIT_BY_TOOL_NAME: Record<string, MongoToolkitSpec>;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MongoDB AI Toolkit — las herramientas que un mongoAction expone cuando
|
|
3
|
+
* `aiEnabled` está encendido.
|
|
4
|
+
*
|
|
5
|
+
* ## Lo que el modelo NO elige (2026-09-24, decisiones de Ariel)
|
|
6
|
+
*
|
|
7
|
+
* - **La colección.** Es la del nodo y no hay parámetro para cambiarla: para
|
|
8
|
+
* tocar otra se conecta otro nodo. Una herramienta de base de datos que deja
|
|
9
|
+
* al modelo nombrar la colección le da acceso a todo lo que la credencial
|
|
10
|
+
* alcanza, y eso no se ve al mirar el lienzo.
|
|
11
|
+
* - **El JavaScript del servidor.** `$where`, `$function` y `$accumulator`
|
|
12
|
+
* ejecutan código dentro de Mongo; el handler los rechaza en cualquier
|
|
13
|
+
* filtro o pipeline que venga del modelo.
|
|
14
|
+
* - **Escribir desde una agregación.** `$out` y `$merge` son las dos etapas que
|
|
15
|
+
* escriben; `aggregate_documents` las rechaza, y por eso cuenta como lectura.
|
|
16
|
+
*
|
|
17
|
+
* ## Los nombres
|
|
18
|
+
*
|
|
19
|
+
* Cada nombre empieza por el verbo que dice lo que hace, porque el `destructive`
|
|
20
|
+
* de cada operación lo pone `marcarDestructivas` leyendo ese verbo (ver
|
|
21
|
+
* `clase-de-herramienta.ts`). Por eso `findOneAndUpdate` se ofrece como
|
|
22
|
+
* `update_and_return_document` y no como `find_and_update_document`: con el
|
|
23
|
+
* segundo nombre el verbo diría «lectura» de algo que pisa un documento.
|
|
24
|
+
*
|
|
25
|
+
* Los textos van en inglés porque los lee el modelo.
|
|
26
|
+
*/
|
|
27
|
+
import { marcarDestructivas } from './clase-de-herramienta.js';
|
|
28
|
+
const p = (name, description, required = true, type = 'string') => ({ name, type, description, required });
|
|
29
|
+
const filtro = (para, required = true) => p('filter', `JSON object with a MongoDB query filter that selects ${para}, e.g. {"email": "a@b.c"} or {"total": {"$gt": 100}}. Server-side JavaScript operators ($where, $function, $accumulator) are rejected.`, required);
|
|
30
|
+
const proyeccion = () => p('projection', 'Optional JSON object choosing the fields to return, e.g. {"name": 1, "email": 1}. Leave it out to return whole documents.', false);
|
|
31
|
+
export const MONGO_TOOLKIT_SPECS = marcarDestructivas([
|
|
32
|
+
{
|
|
33
|
+
operation: 'findAll',
|
|
34
|
+
label: 'Find documents',
|
|
35
|
+
toolName: 'find_documents',
|
|
36
|
+
description: "Return the documents of this node's collection that match a filter. Returns at most `limit` documents — use a filter that narrows the result instead of reading the whole collection.",
|
|
37
|
+
parameters: [
|
|
38
|
+
filtro('the documents to return. {} matches every document', false),
|
|
39
|
+
proyeccion(),
|
|
40
|
+
p('sort', 'Optional JSON object with the sort order, e.g. {"createdAt": -1} for newest first.', false),
|
|
41
|
+
p('limit', 'Maximum number of documents to return (default 20, maximum 100).', false, 'number'),
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
operation: 'findOne',
|
|
46
|
+
label: 'Find one document',
|
|
47
|
+
toolName: 'find_one_document',
|
|
48
|
+
description: "Return the first document of this node's collection that matches a filter, or nothing when none does.",
|
|
49
|
+
parameters: [filtro('the document'), proyeccion()],
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
operation: 'aggregate',
|
|
53
|
+
label: 'Aggregate documents',
|
|
54
|
+
toolName: 'aggregate_documents',
|
|
55
|
+
description: "Run an aggregation pipeline over this node's collection and return its result — for counts, sums, groupings and joins with $lookup. It only reads: the $out and $merge stages, which write, are rejected.",
|
|
56
|
+
parameters: [
|
|
57
|
+
p('pipeline', 'JSON array of aggregation stages, e.g. [{"$match": {"status": "paid"}}, {"$group": {"_id": "$customer", "total": {"$sum": "$amount"}}}].'),
|
|
58
|
+
],
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
operation: 'insertOne',
|
|
62
|
+
label: 'Insert document',
|
|
63
|
+
toolName: 'insert_document',
|
|
64
|
+
description: "Insert one new document into this node's collection and return its _id. It does not check for duplicates — when the document might already exist, find it first.",
|
|
65
|
+
parameters: [
|
|
66
|
+
p('document', 'JSON object with the new document, e.g. {"name": "Ariel", "email": "a@b.c"}.'),
|
|
67
|
+
],
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
operation: 'updateOne',
|
|
71
|
+
label: 'Update document',
|
|
72
|
+
toolName: 'update_document',
|
|
73
|
+
description: "Update the first document of this node's collection that matches a filter. It overwrites the fields you set. When nothing matches it changes nothing — it does not create a document.",
|
|
74
|
+
parameters: [
|
|
75
|
+
filtro('the document to update. It cannot be empty'),
|
|
76
|
+
p('update', 'JSON object with MongoDB update operators, e.g. {"$set": {"status": "shipped"}} or {"$inc": {"stock": -1}}. A plain object without operators is rejected, because it would replace the whole document.'),
|
|
77
|
+
],
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
operation: 'findOneAndUpdate',
|
|
81
|
+
label: 'Update and return document',
|
|
82
|
+
toolName: 'update_and_return_document',
|
|
83
|
+
description: "Update the first document of this node's collection that matches a filter and return it as it is AFTER the update. Use it when you need the updated values in your reply; otherwise update_document is enough.",
|
|
84
|
+
parameters: [
|
|
85
|
+
filtro('the document to update. It cannot be empty'),
|
|
86
|
+
p('update', 'JSON object with MongoDB update operators, e.g. {"$set": {"status": "shipped"}}. A plain object without operators is rejected.'),
|
|
87
|
+
],
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
operation: 'deleteOne',
|
|
91
|
+
label: 'Delete document',
|
|
92
|
+
toolName: 'delete_document',
|
|
93
|
+
description: "Delete the first document of this node's collection that matches a filter. This cannot be undone. When you are not sure which document the filter selects, call find_one_document first.",
|
|
94
|
+
parameters: [filtro('the document to delete. It cannot be empty')],
|
|
95
|
+
},
|
|
96
|
+
]);
|
|
97
|
+
/** Las herramientas por nombre, para despachar una llamada del modelo. */
|
|
98
|
+
export const MONGO_TOOLKIT_BY_TOOL_NAME = Object.fromEntries(MONGO_TOOLKIT_SPECS.map((s) => [s.toolName, s]));
|