@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
package/dist/gmail-operations.js
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GMAIL_SEND_LEGACY_FIELDS = exports.NATIVE_EMAIL_TOOLKIT_BY_TOOL_NAME = exports.GMAIL_TOOLKIT_BY_TOOL_NAME = exports.NATIVE_EMAIL_TOOLKIT_SPECS = exports.GMAIL_ALL_TOOLKIT_SPECS = exports.GMAIL_SEND_AND_WAIT_TOOL_SPEC = exports.GMAIL_TOOLKIT_SPECS = exports.GMAIL_TOOLKIT_OPERATIONS = exports.GMAIL_DROPDOWN_OPERATIONS = exports.GMAIL_OPERATION_SPECS = exports.GMAIL_OPERATION_GROUPS = exports.GMAIL_OPERATIONS = void 0;
|
|
4
|
-
exports.isGmailOperation = isGmailOperation;
|
|
5
|
-
exports.resolveGmailSendFields = resolveGmailSendFields;
|
|
6
2
|
/**
|
|
7
3
|
* Gmail operation enum — single source of truth across the API, Dashboard,
|
|
8
4
|
* and Message Broker. Used by:
|
|
@@ -17,6 +13,11 @@ exports.resolveGmailSendFields = resolveGmailSendFields;
|
|
|
17
13
|
* dashboard owns the UI form schema, the api owns the dispatch logic),
|
|
18
14
|
* but the canonical list of valid operation strings lives here.
|
|
19
15
|
*/
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.GMAIL_SEND_LEGACY_FIELDS = exports.NATIVE_EMAIL_TOOLKIT_BY_TOOL_NAME = exports.GMAIL_TOOLKIT_BY_TOOL_NAME = exports.NATIVE_EMAIL_TOOLKIT_SPECS = exports.GMAIL_ALL_TOOLKIT_SPECS = exports.GMAIL_SEND_AND_WAIT_TOOL_SPEC = exports.GMAIL_TOOLKIT_SPECS = exports.GMAIL_TOOLKIT_OPERATIONS = exports.GMAIL_DROPDOWN_OPERATIONS = exports.GMAIL_OPERATION_SPECS = exports.GMAIL_OPERATION_GROUPS = exports.GMAIL_OPERATIONS = void 0;
|
|
18
|
+
exports.isGmailOperation = isGmailOperation;
|
|
19
|
+
exports.resolveGmailSendFields = resolveGmailSendFields;
|
|
20
|
+
const clase_de_herramienta_js_1 = require("./clase-de-herramienta.js");
|
|
20
21
|
exports.GMAIL_OPERATIONS = [
|
|
21
22
|
'send',
|
|
22
23
|
// Pause-the-pipeline op — sends an email with Approve / (optional)
|
|
@@ -301,7 +302,7 @@ const p = (name, description, required = true, type = 'string') => ({ name, type
|
|
|
301
302
|
const ADJUNTOS = p('attachments', 'Optional. Files to attach, taken from the payload: pass the `_file` reference object(s) ' +
|
|
302
303
|
'exactly as they appear (a single `_file`, or the `_files` / `files` array), as a JSON ' +
|
|
303
304
|
'string. Never invent one. Up to 5 files, 25 MB in total.', false);
|
|
304
|
-
exports.GMAIL_TOOLKIT_SPECS = [
|
|
305
|
+
exports.GMAIL_TOOLKIT_SPECS = (0, clase_de_herramienta_js_1.marcarDestructivas)([
|
|
305
306
|
{
|
|
306
307
|
operation: 'send',
|
|
307
308
|
label: 'Send message',
|
|
@@ -510,7 +511,7 @@ exports.GMAIL_TOOLKIT_SPECS = [
|
|
|
510
511
|
p('threadId', 'Gmail thread id.'),
|
|
511
512
|
],
|
|
512
513
|
},
|
|
513
|
-
];
|
|
514
|
+
]);
|
|
514
515
|
/**
|
|
515
516
|
* La op que espera, **fuera** del toolkit y aparte a propósito. Sigue haciendo
|
|
516
517
|
* falta para dos cosas que no son el toolkit: reconocer la operación de una
|
|
@@ -540,12 +541,12 @@ exports.GMAIL_SEND_AND_WAIT_TOOL_SPEC = {
|
|
|
540
541
|
],
|
|
541
542
|
};
|
|
542
543
|
/** Todo lo que el nodo sabe ejecutar, se ofrezca o no como herramienta. */
|
|
543
|
-
exports.GMAIL_ALL_TOOLKIT_SPECS = [
|
|
544
|
+
exports.GMAIL_ALL_TOOLKIT_SPECS = (0, clase_de_herramienta_js_1.marcarDestructivas)([
|
|
544
545
|
...exports.GMAIL_TOOLKIT_SPECS,
|
|
545
546
|
exports.GMAIL_SEND_AND_WAIT_TOOL_SPEC,
|
|
546
|
-
];
|
|
547
|
+
]);
|
|
547
548
|
/** El toolkit del proveedor nativo (Resend): una sola herramienta. */
|
|
548
|
-
exports.NATIVE_EMAIL_TOOLKIT_SPECS = [
|
|
549
|
+
exports.NATIVE_EMAIL_TOOLKIT_SPECS = (0, clase_de_herramienta_js_1.marcarDestructivas)([
|
|
549
550
|
{
|
|
550
551
|
operation: 'send',
|
|
551
552
|
label: 'Send email',
|
|
@@ -564,7 +565,7 @@ exports.NATIVE_EMAIL_TOOLKIT_SPECS = [
|
|
|
564
565
|
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),
|
|
565
566
|
],
|
|
566
567
|
},
|
|
567
|
-
];
|
|
568
|
+
]);
|
|
568
569
|
exports.GMAIL_TOOLKIT_BY_TOOL_NAME = Object.fromEntries(exports.GMAIL_ALL_TOOLKIT_SPECS.map((s) => [s.toolName, s]));
|
|
569
570
|
exports.NATIVE_EMAIL_TOOLKIT_BY_TOOL_NAME = Object.fromEntries(exports.NATIVE_EMAIL_TOOLKIT_SPECS.map((s) => [s.toolName, s]));
|
|
570
571
|
/** 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,183 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Google Contacts AI Toolkit — las herramientas que un googleContactsAction
|
|
4
|
+
* expone cuando `aiEnabled` está encendido.
|
|
5
|
+
*
|
|
6
|
+
* **Se escribe una sola vez** (2026-09-24). Vivía dos veces: en
|
|
7
|
+
* `api/src/mcp-servers/toolkit-specs.ts` y en
|
|
8
|
+
* `dashboard/components/google-contacts-actions/google-contacts-operations-schemas.ts`,
|
|
9
|
+
* las dos a mano. Al mudarlas coincidían exactamente —las 15 operaciones, sus
|
|
10
|
+
* nombres, textos y parámetros—; el `group` del dashboard ya lo lleva el spec
|
|
11
|
+
* de formulario (`GOOGLE_CONTACTS_OPERATION_SPECS[op].group`).
|
|
12
|
+
*
|
|
13
|
+
* Se llama `GOOGLE_CONTACTS_TOOLKIT_SPECS` y no `…_OPERATION_SPECS` porque ese
|
|
14
|
+
* nombre ya es el del FORMULARIO del nodo en este paquete — la misma pareja que
|
|
15
|
+
* Discord y Slack.
|
|
16
|
+
*
|
|
17
|
+
* ⚠️ El `destructive` ya no se escribe a mano: lo pone `marcarDestructivas` por
|
|
18
|
+
* el verbo. Cuatro que la copia vieja marcaba dejan de serlo —crear o añadir no
|
|
19
|
+
* pisa nada—: `create_contact`, `add_contact_to_group`,
|
|
20
|
+
* `batch_create_contacts` y `create_contact_group`. El gate del AI Node ya las
|
|
21
|
+
* leía así (por el verbo del nombre); lo que cambia es la etiqueta del panel.
|
|
22
|
+
*
|
|
23
|
+
* Los textos van en inglés porque los lee el modelo.
|
|
24
|
+
*/
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.GOOGLE_CONTACTS_TOOLKIT_BY_TOOL_NAME = exports.GOOGLE_CONTACTS_TOOLKIT_SPECS = void 0;
|
|
27
|
+
const clase_de_herramienta_js_1 = require("./clase-de-herramienta.js");
|
|
28
|
+
const p = (name, description, required = true, type = 'string') => ({ name, type, description, required });
|
|
29
|
+
exports.GOOGLE_CONTACTS_TOOLKIT_SPECS = (0, clase_de_herramienta_js_1.marcarDestructivas)([
|
|
30
|
+
// ── Read ─────────────────────────────────────────────────────────
|
|
31
|
+
{
|
|
32
|
+
operation: 'searchContacts',
|
|
33
|
+
label: 'Search contacts',
|
|
34
|
+
toolName: 'search_contacts',
|
|
35
|
+
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.",
|
|
36
|
+
parameters: [
|
|
37
|
+
p('query', 'Free-text query (name fragment, email, phone, organization).'),
|
|
38
|
+
p('pageSize', 'Max results (default 30, hard cap 30).', false, 'number'),
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
operation: 'listContacts',
|
|
43
|
+
label: 'List contacts',
|
|
44
|
+
toolName: 'list_contacts',
|
|
45
|
+
description: 'Paginated list of every contact. Prefer searchContacts for name/email lookup — listContacts returns hundreds of rows even when the user named one.',
|
|
46
|
+
parameters: [
|
|
47
|
+
p('pageSize', 'Page size (default 100, max 1000).', false, 'number'),
|
|
48
|
+
p('pageToken', 'Token returned by previous listContacts. Empty for first page.', false),
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
operation: 'getContact',
|
|
53
|
+
label: 'Get contact',
|
|
54
|
+
toolName: 'get_contact',
|
|
55
|
+
description: 'Fetch a single contact by resourceName. Use AFTER searchContacts to read the full record before updating.',
|
|
56
|
+
parameters: [
|
|
57
|
+
p('resourceName', 'People API id, e.g. "people/c12345". Get from searchContacts results.'),
|
|
58
|
+
],
|
|
59
|
+
},
|
|
60
|
+
// ── Write ────────────────────────────────────────────────────────
|
|
61
|
+
{
|
|
62
|
+
operation: 'createContact',
|
|
63
|
+
label: 'Create contact',
|
|
64
|
+
toolName: 'create_contact',
|
|
65
|
+
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.",
|
|
66
|
+
parameters: [
|
|
67
|
+
p('fullName', 'Full name (e.g. "Ariel Pérez"). Auto-splits to given + family.', false),
|
|
68
|
+
p('givenName', 'First name. Overrides the fullName split.', false),
|
|
69
|
+
p('familyName', 'Last name. Overrides the fullName split.', false),
|
|
70
|
+
p('emailAddresses', 'Array of email addresses. JSON-encode if your tool layer expects a string.', false),
|
|
71
|
+
p('phoneNumbers', 'Array of phone numbers.', false),
|
|
72
|
+
p('notes', 'Free-form note attached to the contact.', false),
|
|
73
|
+
],
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
operation: 'updateContact',
|
|
77
|
+
label: 'Update contact',
|
|
78
|
+
toolName: 'update_contact',
|
|
79
|
+
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).",
|
|
80
|
+
parameters: [
|
|
81
|
+
p('resourceName', 'People API id, e.g. "people/c12345".'),
|
|
82
|
+
p('fullName', 'New full name (auto-splits).', false),
|
|
83
|
+
p('emailAddresses', 'Replace email list. Pass [] to clear.', false),
|
|
84
|
+
p('phoneNumbers', 'Replace phone list.', false),
|
|
85
|
+
p('notes', "Replace the contact's note.", false),
|
|
86
|
+
],
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
operation: 'deleteContact',
|
|
90
|
+
label: 'Delete contact',
|
|
91
|
+
toolName: 'delete_contact',
|
|
92
|
+
description: 'Permanently remove a contact. Irreversible. ALWAYS confirm with the user before calling. Use searchContacts first to verify you have the right resourceName.',
|
|
93
|
+
parameters: [p('resourceName', 'People API id of the contact to delete.')],
|
|
94
|
+
},
|
|
95
|
+
// ── Groups ───────────────────────────────────────────────────────
|
|
96
|
+
{
|
|
97
|
+
operation: 'listContactGroups',
|
|
98
|
+
label: 'List groups',
|
|
99
|
+
toolName: 'list_contact_groups',
|
|
100
|
+
description: "List the user's contact groups (labels). Call this BEFORE addContactToGroup / removeContactFromGroup so you have the right groupResourceName.",
|
|
101
|
+
parameters: [
|
|
102
|
+
p('pageSize', 'Page size (default 200, max 1000).', false, 'number'),
|
|
103
|
+
],
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
operation: 'addContactToGroup',
|
|
107
|
+
label: 'Add to group',
|
|
108
|
+
toolName: 'add_contact_to_group',
|
|
109
|
+
description: 'Add a contact to a group (label). Idempotent — no error if the contact is already in the group. Get the groupResourceName from listContactGroups.',
|
|
110
|
+
parameters: [
|
|
111
|
+
p('resourceName', 'Contact id, e.g. "people/c12345". Or array of contact ids.'),
|
|
112
|
+
p('groupResourceName', 'Group id, e.g. "contactGroups/12345".'),
|
|
113
|
+
],
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
operation: 'removeContactFromGroup',
|
|
117
|
+
label: 'Remove from group',
|
|
118
|
+
toolName: 'remove_contact_from_group',
|
|
119
|
+
description: 'Remove a contact from a group. Idempotent. Does NOT delete the contact, only its membership in that group.',
|
|
120
|
+
parameters: [
|
|
121
|
+
p('resourceName', 'Contact id, e.g. "people/c12345".'),
|
|
122
|
+
p('groupResourceName', 'Group id, e.g. "contactGroups/12345".'),
|
|
123
|
+
],
|
|
124
|
+
},
|
|
125
|
+
// ── V2 — bulk + group management ─────────────────────────────────
|
|
126
|
+
{
|
|
127
|
+
operation: 'batchCreateContacts',
|
|
128
|
+
label: 'Batch create contacts',
|
|
129
|
+
toolName: 'batch_create_contacts',
|
|
130
|
+
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.).',
|
|
131
|
+
parameters: [
|
|
132
|
+
p('contacts', 'Array of contact objects. Same shape as createContact.', true),
|
|
133
|
+
],
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
operation: 'batchUpdateContacts',
|
|
137
|
+
label: 'Batch update contacts',
|
|
138
|
+
toolName: 'batch_update_contacts',
|
|
139
|
+
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.',
|
|
140
|
+
parameters: [
|
|
141
|
+
p('contacts', 'Array of {resourceName, ...fields} objects.', true),
|
|
142
|
+
p('updateMask', 'Comma-separated People API field paths to replace.'),
|
|
143
|
+
],
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
operation: 'batchDeleteContacts',
|
|
147
|
+
label: 'Batch delete contacts',
|
|
148
|
+
toolName: 'batch_delete_contacts',
|
|
149
|
+
description: 'Bulk-delete up to 500 contacts by resourceName. Irreversible.',
|
|
150
|
+
parameters: [
|
|
151
|
+
p('resourceNames', 'Array of People API ids, each like "people/c12345".'),
|
|
152
|
+
],
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
operation: 'createContactGroup',
|
|
156
|
+
label: 'Create group',
|
|
157
|
+
toolName: 'create_contact_group',
|
|
158
|
+
description: 'Create a new contact group (label).',
|
|
159
|
+
parameters: [p('name', 'Group name as displayed in Contacts.')],
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
operation: 'updateContactGroup',
|
|
163
|
+
label: 'Rename group',
|
|
164
|
+
toolName: 'update_contact_group',
|
|
165
|
+
description: 'Rename an existing contact group.',
|
|
166
|
+
parameters: [
|
|
167
|
+
p('resourceName', 'Group id, e.g. "contactGroups/12345".'),
|
|
168
|
+
p('name', 'New name for the group.'),
|
|
169
|
+
],
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
operation: 'deleteContactGroup',
|
|
173
|
+
label: 'Delete group',
|
|
174
|
+
toolName: 'delete_contact_group',
|
|
175
|
+
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.',
|
|
176
|
+
parameters: [
|
|
177
|
+
p('resourceName', 'Group id, e.g. "contactGroups/12345".'),
|
|
178
|
+
p('deleteContacts', 'When true, also delete contacts in the group. Default false.', false, 'boolean'),
|
|
179
|
+
],
|
|
180
|
+
},
|
|
181
|
+
]);
|
|
182
|
+
/** Las herramientas por nombre, para despachar una llamada del modelo. */
|
|
183
|
+
exports.GOOGLE_CONTACTS_TOOLKIT_BY_TOOL_NAME = Object.fromEntries(exports.GOOGLE_CONTACTS_TOOLKIT_SPECS.map((s) => [s.toolName, s]));
|
package/dist/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/index.js
CHANGED
|
@@ -3,7 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.GMAIL_SEND_LEGACY_FIELDS = exports.NATIVE_EMAIL_TOOLKIT_BY_TOOL_NAME = exports.GMAIL_TOOLKIT_BY_TOOL_NAME = exports.NATIVE_EMAIL_TOOLKIT_SPECS = exports.GMAIL_SEND_AND_WAIT_TOOL_SPEC = exports.GMAIL_ALL_TOOLKIT_SPECS = exports.GMAIL_TOOLKIT_SPECS = exports.GMAIL_TOOLKIT_OPERATIONS = exports.GMAIL_DROPDOWN_OPERATIONS = exports.GMAIL_OPERATION_GROUPS = exports.GMAIL_OPERATION_SPECS = exports.GMAIL_OPERATIONS = exports.versionCatalogErrors = exports.fieldsLost = exports.fieldsLostBetween = exports.currentVersion = exports.versionSpec = exports.versionsOf = exports.isVersioned = exports.NODE_TYPE_TO_PREFIX = exports.PREFIX_TO_NODE_TYPE = exports.NODE_STATE_KEYS = exports.NODE_COLORS = exports.NODE_DETAIL_PATHS = exports.getNodeRegistryEntry = exports.NODE_REGISTRY = exports.pasaLoQueRecibe = exports.getNodeDispatchConfig = exports.getAllNodeCollections = exports.NODE_DISPATCH = exports.todosLosOutputGroups = exports.outputGroupsFor = exports.esEtiquetaDeSentimiento = exports.SENTIMENT_PORT_SUMMARY = exports.SENTIMENT_PORT_LABEL = exports.SENTIMENT_PORTS = exports.SENTIMENT_UNCLEAR = exports.SENTIMENT_LABELS = exports.resolveNodeId = exports.PREFIX_TO_TYPE = exports.NODE_UI = exports.ALL_NODE_TYPES = exports.isNodeType = exports.isTerminal = exports.canSendToNodes = exports.canReceiveFromNodes = exports.canReceiveFrom = exports.NODE_CONNECTIONS = exports.iterableMeta = exports.singleMeta = void 0;
|
|
4
4
|
exports.isGithubOperation = exports.GITHUB_ITERABLE_OPERATIONS = exports.GITHUB_DROPDOWN_OPERATIONS = exports.GITHUB_OPERATION_SPECS = exports.GITHUB_OPERATIONS = exports.scopesQueFaltanEnShopify = exports.isShopifyOperation = exports.SHOPIFY_PRODUCT_STATUSES = exports.SHOPIFY_CANCEL_REASONS = exports.SHOPIFY_SEARCHABLE_RESOURCES = exports.SHOPIFY_TAGGABLE_RESOURCES = exports.SHOPIFY_OPERATION_SCOPES = exports.SHOPIFY_OPERATION_SPECS = exports.SHOPIFY_OPERATIONS = exports.isMailchimpOperation = exports.MAILCHIMP_CONTACT_STATUSES = exports.MAILCHIMP_OPERATION_SPECS = exports.MAILCHIMP_OPERATIONS = exports.herramientasDeDiscordPara = exports.DISCORD_TOOLKIT_BY_TOOL_NAME = exports.DISCORD_TOOLKIT_SPECS = exports.isDiscordOperation = exports.camposDeDiscordNoDisponibles = exports.discordPuedeEjecutar = exports.operacionesDeDiscordPara = exports.DISCORD_CAPACIDADES_POR_CREDENCIAL = exports.DISCORD_OPERATION_SPECS = exports.DISCORD_OPERATIONS = exports.camposNoDisponiblesPara = exports.puedeEjecutar = exports.operacionesPara = exports.isWhatsAppOperation = exports.WHATSAPP_OPERATIONS = exports.TELEGRAM_TOOLKIT_BY_TOOL_NAME = exports.TELEGRAM_TOOLKIT_SPECS = exports.isTelegramOperation = exports.TELEGRAM_OPERATION_SPECS = exports.TELEGRAM_OPERATIONS = exports.DRIVE_TOOLKIT_BY_TOOL_NAME = exports.DRIVE_TOOLKIT_SPECS = exports.isDriveOperation = exports.DRIVE_OPERATION_SPECS = exports.DRIVE_OPERATIONS = exports.GOOGLE_CALENDAR_TOOLKIT_BY_TOOL_NAME = exports.GOOGLE_CALENDAR_TOOLKIT_SPECS = exports.isGoogleCalendarOperation = exports.GOOGLE_CALENDAR_OPERATION_SPECS = exports.GOOGLE_CALENDAR_OPERATIONS = exports.isGmailOperation = exports.resolveGmailSendFields = void 0;
|
|
5
5
|
exports.NOTION_OPERATION_SPECS = exports.NOTION_OPERATIONS = exports.isGoogleAnalyticsOperation = exports.GOOGLE_ANALYTICS_DROPDOWN_OPERATIONS = exports.GOOGLE_ANALYTICS_OPERATION_SPECS = exports.GOOGLE_ANALYTICS_OPERATIONS = exports.isGoogleContactsOperation = exports.GOOGLE_CONTACTS_DEFAULT_PERSON_FIELDS = exports.GOOGLE_CONTACTS_OPERATION_GROUPS = exports.GOOGLE_CONTACTS_OPERATION_SPECS = exports.GOOGLE_CONTACTS_OPERATIONS_V2 = exports.GOOGLE_CONTACTS_OPERATIONS_V1 = exports.GOOGLE_CONTACTS_OPERATIONS = exports.SHEETS_TOOLKIT_DEFAULTABLE = exports.SHEETS_TOOLKIT_BY_TOOL_NAME = exports.SHEETS_TOOLKIT_SPECS = exports.isSheetsOperation = exports.SHEETS_OPERATION_SPECS = exports.SHEETS_OPERATIONS = exports.herramientasDeSlackPara = exports.SLACK_TOOLKIT_BY_TOOL_NAME = exports.SLACK_TOOLKIT_SPECS = exports.isSlackOperation = exports.camposDeSlackNoDisponibles = exports.slackPuedeEjecutar = exports.operacionesDeSlackPara = exports.SLACK_CAPACIDADES_POR_CREDENCIAL = exports.SLACK_OPERATION_SPECS = exports.SLACK_OPERATIONS = exports.isAirtableOperation = exports.AIRTABLE_ITERABLE_OPERATIONS = exports.AIRTABLE_OPERATION_SPECS = exports.AIRTABLE_OPERATIONS = exports.isCalendlyOperation = exports.CALENDLY_ITERABLE_OPERATIONS = exports.CALENDLY_OPERATION_SPECS = exports.CALENDLY_OPERATIONS = exports.isApifyOperation = exports.APIFY_ITERABLE_OPERATIONS = exports.APIFY_OPERATION_SPECS = exports.APIFY_OPERATIONS = exports.isBucketOperation = exports.BUCKET_ITERABLE_OPERATIONS = exports.BUCKET_OPERATION_SPECS = exports.BUCKET_OPERATIONS = exports.isJiraOperation = exports.JIRA_ITERABLE_OPERATIONS = exports.JIRA_DROPDOWN_OPERATIONS = exports.JIRA_OPERATION_SPECS = exports.JIRA_OPERATIONS = void 0;
|
|
6
|
-
exports.
|
|
6
|
+
exports.isCredentialType = exports.getCredentialType = exports.credentialTypeValues = exports.CREDENTIAL_TYPE_VALUES = exports.CREDENTIAL_TYPES = exports.ventanaDeContextoDeOpenRouter = exports.opcionesDeModelosDeOpenRouter = exports.URL_DE_MODELOS_DE_OPENROUTER = exports.getModelLabel = exports.getDefaultModel = exports.getModelsFor = exports.MODEL_CONTEXT_WINDOWS = exports.LLM_MODELS = exports.LLM_PROVIDERS = exports.GOOGLE_CONTACTS_TOOLKIT_BY_TOOL_NAME = exports.GOOGLE_CONTACTS_TOOLKIT_SPECS = exports.motivoParaNoCorrer = exports.mensajeDeHerramientaBloqueada = exports.MENSAJE_SIN_HERRAMIENTA = exports.herramientaBloqueadaEn = exports.bloqueadasDe = exports.nombresDeHerramientas = exports.admiteBloqueo = exports.tieneModoToolkit = exports.TIPOS_CON_TOOLKIT = exports.esOperacionDestructiva = exports.operacionDeToolkit = exports.TOOLKITS_POR_TIPO = exports.marcarDestructivas = exports.esHerramientaDestructiva = exports.claseDeHerramienta = exports.POSTGRES_TOOLKIT_BY_TOOL_NAME = exports.POSTGRES_TOOLKIT_SPECS = exports.MONGO_TOOLKIT_BY_TOOL_NAME = exports.MONGO_TOOLKIT_SPECS = exports.DOCS_TOOLKIT_DEFAULTABLE = exports.DOCS_TOOLKIT_BY_TOOL_NAME = exports.DOCS_TOOLKIT_SPECS = exports.isDocsOperation = exports.DOCS_OPERATION_SPECS = exports.DOCS_OPERATIONS = exports.isMongoOperation = exports.MONGO_OPERATION_SPECS = exports.MONGO_OPERATIONS = exports.isPostgresOperation = exports.POSTGRES_OPERATION_SPECS = exports.POSTGRES_MODES = exports.POSTGRES_OPERATIONS = exports.isNotionOperation = exports.NOTION_DROPDOWN_OPERATIONS = void 0;
|
|
7
|
+
exports.armarRespuestaDelSync = exports.RESPUESTA_DEL_SYNC_POR_DEFECTO = exports.TOPE_DE_ESPERA_DEL_SYNC = exports.TOPES_DE_ESTADO = exports.SOBRES_DE_RESPUESTA = exports.MODOS_DE_PAYLOAD = exports.NIVELES_DE_DETALLE = exports.RESULTADOS_DEL_VALIDADOR = exports.contestaEnSync = exports.NODOS_QUE_CONTESTAN_EN_SYNC = void 0;
|
|
7
8
|
var types_js_1 = require("./types.js");
|
|
8
9
|
Object.defineProperty(exports, "singleMeta", { enumerable: true, get: function () { return types_js_1.singleMeta; } });
|
|
9
10
|
Object.defineProperty(exports, "iterableMeta", { enumerable: true, get: function () { return types_js_1.iterableMeta; } });
|
|
@@ -224,6 +225,36 @@ var docs_toolkit_js_1 = require("./docs-toolkit.js");
|
|
|
224
225
|
Object.defineProperty(exports, "DOCS_TOOLKIT_SPECS", { enumerable: true, get: function () { return docs_toolkit_js_1.DOCS_TOOLKIT_SPECS; } });
|
|
225
226
|
Object.defineProperty(exports, "DOCS_TOOLKIT_BY_TOOL_NAME", { enumerable: true, get: function () { return docs_toolkit_js_1.DOCS_TOOLKIT_BY_TOOL_NAME; } });
|
|
226
227
|
Object.defineProperty(exports, "DOCS_TOOLKIT_DEFAULTABLE", { enumerable: true, get: function () { return docs_toolkit_js_1.DOCS_TOOLKIT_DEFAULTABLE; } });
|
|
228
|
+
// ── Toolkits de bases de datos, y la clase de cada herramienta (2026-09-24) ──
|
|
229
|
+
var mongo_toolkit_js_1 = require("./mongo-toolkit.js");
|
|
230
|
+
Object.defineProperty(exports, "MONGO_TOOLKIT_SPECS", { enumerable: true, get: function () { return mongo_toolkit_js_1.MONGO_TOOLKIT_SPECS; } });
|
|
231
|
+
Object.defineProperty(exports, "MONGO_TOOLKIT_BY_TOOL_NAME", { enumerable: true, get: function () { return mongo_toolkit_js_1.MONGO_TOOLKIT_BY_TOOL_NAME; } });
|
|
232
|
+
var postgres_toolkit_js_1 = require("./postgres-toolkit.js");
|
|
233
|
+
Object.defineProperty(exports, "POSTGRES_TOOLKIT_SPECS", { enumerable: true, get: function () { return postgres_toolkit_js_1.POSTGRES_TOOLKIT_SPECS; } });
|
|
234
|
+
Object.defineProperty(exports, "POSTGRES_TOOLKIT_BY_TOOL_NAME", { enumerable: true, get: function () { return postgres_toolkit_js_1.POSTGRES_TOOLKIT_BY_TOOL_NAME; } });
|
|
235
|
+
var clase_de_herramienta_js_1 = require("./clase-de-herramienta.js");
|
|
236
|
+
Object.defineProperty(exports, "claseDeHerramienta", { enumerable: true, get: function () { return clase_de_herramienta_js_1.claseDeHerramienta; } });
|
|
237
|
+
Object.defineProperty(exports, "esHerramientaDestructiva", { enumerable: true, get: function () { return clase_de_herramienta_js_1.esHerramientaDestructiva; } });
|
|
238
|
+
Object.defineProperty(exports, "marcarDestructivas", { enumerable: true, get: function () { return clase_de_herramienta_js_1.marcarDestructivas; } });
|
|
239
|
+
var toolkits_js_1 = require("./toolkits.js");
|
|
240
|
+
Object.defineProperty(exports, "TOOLKITS_POR_TIPO", { enumerable: true, get: function () { return toolkits_js_1.TOOLKITS_POR_TIPO; } });
|
|
241
|
+
Object.defineProperty(exports, "operacionDeToolkit", { enumerable: true, get: function () { return toolkits_js_1.operacionDeToolkit; } });
|
|
242
|
+
Object.defineProperty(exports, "esOperacionDestructiva", { enumerable: true, get: function () { return toolkits_js_1.esOperacionDestructiva; } });
|
|
243
|
+
Object.defineProperty(exports, "TIPOS_CON_TOOLKIT", { enumerable: true, get: function () { return toolkits_js_1.TIPOS_CON_TOOLKIT; } });
|
|
244
|
+
Object.defineProperty(exports, "tieneModoToolkit", { enumerable: true, get: function () { return toolkits_js_1.tieneModoToolkit; } });
|
|
245
|
+
Object.defineProperty(exports, "admiteBloqueo", { enumerable: true, get: function () { return toolkits_js_1.admiteBloqueo; } });
|
|
246
|
+
Object.defineProperty(exports, "nombresDeHerramientas", { enumerable: true, get: function () { return toolkits_js_1.nombresDeHerramientas; } });
|
|
247
|
+
Object.defineProperty(exports, "bloqueadasDe", { enumerable: true, get: function () { return toolkits_js_1.bloqueadasDe; } });
|
|
248
|
+
Object.defineProperty(exports, "herramientaBloqueadaEn", { enumerable: true, get: function () { return toolkits_js_1.herramientaBloqueadaEn; } });
|
|
249
|
+
Object.defineProperty(exports, "MENSAJE_SIN_HERRAMIENTA", { enumerable: true, get: function () { return toolkits_js_1.MENSAJE_SIN_HERRAMIENTA; } });
|
|
250
|
+
Object.defineProperty(exports, "mensajeDeHerramientaBloqueada", { enumerable: true, get: function () { return toolkits_js_1.mensajeDeHerramientaBloqueada; } });
|
|
251
|
+
Object.defineProperty(exports, "motivoParaNoCorrer", { enumerable: true, get: function () { return toolkits_js_1.motivoParaNoCorrer; } });
|
|
252
|
+
/* Contacts se escribía a mano en la api y en el dashboard; ahora una vez. Se
|
|
253
|
+
llama `…_TOOLKIT_SPECS` porque `GOOGLE_CONTACTS_OPERATION_SPECS` ya es el
|
|
254
|
+
formulario del nodo — la misma pareja que Discord y Slack. */
|
|
255
|
+
var google_contacts_toolkit_js_1 = require("./google-contacts-toolkit.js");
|
|
256
|
+
Object.defineProperty(exports, "GOOGLE_CONTACTS_TOOLKIT_SPECS", { enumerable: true, get: function () { return google_contacts_toolkit_js_1.GOOGLE_CONTACTS_TOOLKIT_SPECS; } });
|
|
257
|
+
Object.defineProperty(exports, "GOOGLE_CONTACTS_TOOLKIT_BY_TOOL_NAME", { enumerable: true, get: function () { return google_contacts_toolkit_js_1.GOOGLE_CONTACTS_TOOLKIT_BY_TOOL_NAME; } });
|
|
227
258
|
var llm_models_js_1 = require("./llm-models.js");
|
|
228
259
|
Object.defineProperty(exports, "LLM_PROVIDERS", { enumerable: true, get: function () { return llm_models_js_1.LLM_PROVIDERS; } });
|
|
229
260
|
Object.defineProperty(exports, "LLM_MODELS", { enumerable: true, get: function () { return llm_models_js_1.LLM_MODELS; } });
|
|
@@ -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,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* MongoDB AI Toolkit — las herramientas que un mongoAction expone cuando
|
|
4
|
+
* `aiEnabled` está encendido.
|
|
5
|
+
*
|
|
6
|
+
* ## Lo que el modelo NO elige (2026-09-24, decisiones de Ariel)
|
|
7
|
+
*
|
|
8
|
+
* - **La colección.** Es la del nodo y no hay parámetro para cambiarla: para
|
|
9
|
+
* tocar otra se conecta otro nodo. Una herramienta de base de datos que deja
|
|
10
|
+
* al modelo nombrar la colección le da acceso a todo lo que la credencial
|
|
11
|
+
* alcanza, y eso no se ve al mirar el lienzo.
|
|
12
|
+
* - **El JavaScript del servidor.** `$where`, `$function` y `$accumulator`
|
|
13
|
+
* ejecutan código dentro de Mongo; el handler los rechaza en cualquier
|
|
14
|
+
* filtro o pipeline que venga del modelo.
|
|
15
|
+
* - **Escribir desde una agregación.** `$out` y `$merge` son las dos etapas que
|
|
16
|
+
* escriben; `aggregate_documents` las rechaza, y por eso cuenta como lectura.
|
|
17
|
+
*
|
|
18
|
+
* ## Los nombres
|
|
19
|
+
*
|
|
20
|
+
* Cada nombre empieza por el verbo que dice lo que hace, porque el `destructive`
|
|
21
|
+
* de cada operación lo pone `marcarDestructivas` leyendo ese verbo (ver
|
|
22
|
+
* `clase-de-herramienta.ts`). Por eso `findOneAndUpdate` se ofrece como
|
|
23
|
+
* `update_and_return_document` y no como `find_and_update_document`: con el
|
|
24
|
+
* segundo nombre el verbo diría «lectura» de algo que pisa un documento.
|
|
25
|
+
*
|
|
26
|
+
* Los textos van en inglés porque los lee el modelo.
|
|
27
|
+
*/
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.MONGO_TOOLKIT_BY_TOOL_NAME = exports.MONGO_TOOLKIT_SPECS = void 0;
|
|
30
|
+
const clase_de_herramienta_js_1 = require("./clase-de-herramienta.js");
|
|
31
|
+
const p = (name, description, required = true, type = 'string') => ({ name, type, description, required });
|
|
32
|
+
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);
|
|
33
|
+
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);
|
|
34
|
+
exports.MONGO_TOOLKIT_SPECS = (0, clase_de_herramienta_js_1.marcarDestructivas)([
|
|
35
|
+
{
|
|
36
|
+
operation: 'findAll',
|
|
37
|
+
label: 'Find documents',
|
|
38
|
+
toolName: 'find_documents',
|
|
39
|
+
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.",
|
|
40
|
+
parameters: [
|
|
41
|
+
filtro('the documents to return. {} matches every document', false),
|
|
42
|
+
proyeccion(),
|
|
43
|
+
p('sort', 'Optional JSON object with the sort order, e.g. {"createdAt": -1} for newest first.', false),
|
|
44
|
+
p('limit', 'Maximum number of documents to return (default 20, maximum 100).', false, 'number'),
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
operation: 'findOne',
|
|
49
|
+
label: 'Find one document',
|
|
50
|
+
toolName: 'find_one_document',
|
|
51
|
+
description: "Return the first document of this node's collection that matches a filter, or nothing when none does.",
|
|
52
|
+
parameters: [filtro('the document'), proyeccion()],
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
operation: 'aggregate',
|
|
56
|
+
label: 'Aggregate documents',
|
|
57
|
+
toolName: 'aggregate_documents',
|
|
58
|
+
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.",
|
|
59
|
+
parameters: [
|
|
60
|
+
p('pipeline', 'JSON array of aggregation stages, e.g. [{"$match": {"status": "paid"}}, {"$group": {"_id": "$customer", "total": {"$sum": "$amount"}}}].'),
|
|
61
|
+
],
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
operation: 'insertOne',
|
|
65
|
+
label: 'Insert document',
|
|
66
|
+
toolName: 'insert_document',
|
|
67
|
+
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.",
|
|
68
|
+
parameters: [
|
|
69
|
+
p('document', 'JSON object with the new document, e.g. {"name": "Ariel", "email": "a@b.c"}.'),
|
|
70
|
+
],
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
operation: 'updateOne',
|
|
74
|
+
label: 'Update document',
|
|
75
|
+
toolName: 'update_document',
|
|
76
|
+
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.",
|
|
77
|
+
parameters: [
|
|
78
|
+
filtro('the document to update. It cannot be empty'),
|
|
79
|
+
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.'),
|
|
80
|
+
],
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
operation: 'findOneAndUpdate',
|
|
84
|
+
label: 'Update and return document',
|
|
85
|
+
toolName: 'update_and_return_document',
|
|
86
|
+
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.",
|
|
87
|
+
parameters: [
|
|
88
|
+
filtro('the document to update. It cannot be empty'),
|
|
89
|
+
p('update', 'JSON object with MongoDB update operators, e.g. {"$set": {"status": "shipped"}}. A plain object without operators is rejected.'),
|
|
90
|
+
],
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
operation: 'deleteOne',
|
|
94
|
+
label: 'Delete document',
|
|
95
|
+
toolName: 'delete_document',
|
|
96
|
+
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.",
|
|
97
|
+
parameters: [filtro('the document to delete. It cannot be empty')],
|
|
98
|
+
},
|
|
99
|
+
]);
|
|
100
|
+
/** Las herramientas por nombre, para despachar una llamada del modelo. */
|
|
101
|
+
exports.MONGO_TOOLKIT_BY_TOOL_NAME = Object.fromEntries(exports.MONGO_TOOLKIT_SPECS.map((s) => [s.toolName, s]));
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PostgreSQL AI Toolkit — las herramientas que un postgresAction expone cuando
|
|
3
|
+
* `aiEnabled` está encendido.
|
|
4
|
+
*
|
|
5
|
+
* ## Por qué las escrituras NO reciben SQL (2026-09-24, decisión de Ariel)
|
|
6
|
+
*
|
|
7
|
+
* El nodo, en modo de una operación, ejecuta el SQL que se le escribe: sus
|
|
8
|
+
* cinco operaciones son una etiqueta encima del mismo SQL crudo. Si el toolkit
|
|
9
|
+
* hiciera lo mismo, bloquear una herramienta no bloquearía nada — un
|
|
10
|
+
* `insert_rows` puede llevar un `DELETE` dentro de un `WITH`, y quien bloqueó
|
|
11
|
+
* `delete_rows` seguiría viendo desaparecer filas.
|
|
12
|
+
*
|
|
13
|
+
* Así que las tres escrituras reciben la tabla del nodo y JSON, y el SQL lo
|
|
14
|
+
* genera el handler, parametrizado y con los identificadores entrecomillados:
|
|
15
|
+
* el modelo no escribe SQL que se ejecute como escritura.
|
|
16
|
+
*
|
|
17
|
+
* ## Lo que queda con SQL, y cómo se contiene
|
|
18
|
+
*
|
|
19
|
+
* - `query_rows` recibe SQL, y corre dentro de una transacción **READ ONLY**:
|
|
20
|
+
* un `DELETE`, un `UPDATE` o un `CREATE` los rechaza el propio Postgres, no
|
|
21
|
+
* una expresión regular nuestra. Puede leer otras tablas —un JOIN hace
|
|
22
|
+
* falta a menudo—; el límite ahí lo pone el usuario de base de datos de la
|
|
23
|
+
* credencial.
|
|
24
|
+
* - `execute_sql` recibe SQL cualquiera, DDL incluido. Es la excepción
|
|
25
|
+
* consciente a «sólo la tabla del nodo»: SQL crudo no se puede vallar a una
|
|
26
|
+
* tabla. La contienen tres cosas: es siempre destructiva (el gate del AI
|
|
27
|
+
* Node la para si está encendido), se puede bloquear en el nodo, y el
|
|
28
|
+
* usuario de base de datos.
|
|
29
|
+
*
|
|
30
|
+
* Los textos van en inglés porque los lee el modelo.
|
|
31
|
+
*/
|
|
32
|
+
import type { PostgresOperation } from './postgres-operations';
|
|
33
|
+
export interface PostgresToolkitParameter {
|
|
34
|
+
name: string;
|
|
35
|
+
/** El esquema MCP sólo admite estos tres; lo estructurado viaja como JSON
|
|
36
|
+
* en un `string`. */
|
|
37
|
+
type: 'string' | 'number' | 'boolean';
|
|
38
|
+
description: string;
|
|
39
|
+
required: boolean;
|
|
40
|
+
}
|
|
41
|
+
export interface PostgresToolkitSpec {
|
|
42
|
+
operation: PostgresOperation;
|
|
43
|
+
label: string;
|
|
44
|
+
toolName: string;
|
|
45
|
+
description: string;
|
|
46
|
+
parameters: PostgresToolkitParameter[];
|
|
47
|
+
/** Pisa o borra. Lo pone `marcarDestructivas`, no se escribe a mano. */
|
|
48
|
+
destructive?: boolean;
|
|
49
|
+
}
|
|
50
|
+
export declare const POSTGRES_TOOLKIT_SPECS: PostgresToolkitSpec[];
|
|
51
|
+
/** Las herramientas por nombre, para despachar una llamada del modelo. */
|
|
52
|
+
export declare const POSTGRES_TOOLKIT_BY_TOOL_NAME: Record<string, PostgresToolkitSpec>;
|