@mfdaves/okf-odoo 0.0.0-stage → 0.1.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.
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+
3
+ // The only module that knows the host's tool-pack interface (okf-mcp tool-pack
4
+ // API v1, experimental): `okfToolPack = { apiVersion, id, validateConfig,
5
+ // tools }`, tools keyed by name, each `{ description, annotations,
6
+ // inputSchema, outputSchema, scope, handler(args, ctx) }` with
7
+ // `ctx = { principal, subjectToken, config, getSecret, signal }`. Every tool
8
+ // declares `requiresSubjectToken`, so the host hides it where no signed-in
9
+ // user's token exists (stdio, unauthenticated HTTP). If the host changes that
10
+ // shape, only this file changes.
11
+
12
+ const { SCOPE, TOOLS, annotations, runTool, validateConfig } = require("./tools");
13
+
14
+ function createOdooToolPack(dependencies = {}) {
15
+ const tools = {};
16
+ for (const tool of TOOLS) {
17
+ tools[tool.name] = Object.freeze({
18
+ description: tool.description,
19
+ annotations: Object.freeze(annotations(tool.title)),
20
+ inputSchema: tool.inputSchema,
21
+ outputSchema: tool.outputSchema,
22
+ scope: tool.scope || SCOPE,
23
+ requiresSubjectToken: true,
24
+ // The principal is not needed: Odoo identifies the user by the token.
25
+ handler: (args, ctx = {}) =>
26
+ runTool(
27
+ tool,
28
+ args,
29
+ {
30
+ subjectToken: ctx.subjectToken,
31
+ config: ctx.config,
32
+ getSecret: ctx.getSecret,
33
+ signal: ctx.signal,
34
+ },
35
+ dependencies,
36
+ ),
37
+ });
38
+ }
39
+ return Object.freeze({
40
+ apiVersion: "1",
41
+ id: "odoo",
42
+ validateConfig,
43
+ tools: Object.freeze(tools),
44
+ });
45
+ }
46
+
47
+ const okfToolPack = createOdooToolPack();
48
+
49
+ module.exports = { createOdooToolPack, okfToolPack };
package/src/tools.js ADDED
@@ -0,0 +1,520 @@
1
+ "use strict";
2
+
3
+ // The Odoo data tools: their schemas, descriptions and how each maps to an
4
+ // operation of the o3p_mcp data API. Host-independent; src/tool-pack.js
5
+ // adapts them to the host's tool-pack interface.
6
+
7
+ const { DEFAULT_TIMEOUT_MS, OdooToolError, callDataApi } = require("./data-api");
8
+ const { normalizeBaseUrl } = require("./odoo");
9
+ const { violation } = require("./schema");
10
+
11
+ const SCOPE = "odoo.read";
12
+ const ENV_NAME = /^[A-Za-z_][A-Za-z0-9_]*$/;
13
+ const CONFIG_KEYS = new Set(["url", "clientIdEnv", "clientSecretEnv", "timeoutMs"]);
14
+
15
+ const MODEL = {
16
+ type: "string",
17
+ pattern: "^[a-z_][a-z0-9_]*(\\.[a-z0-9_]+)*$",
18
+ maxLength: 128,
19
+ description: "Technical model name, for example res.partner.",
20
+ };
21
+ const FIELD = { type: "string", pattern: "^[a-z_][a-z0-9_]*$", maxLength: 128 };
22
+ const FIELDS = {
23
+ type: "array",
24
+ items: FIELD,
25
+ minItems: 1,
26
+ maxItems: 100,
27
+ description: "Field names to return. Ask only for the fields you need.",
28
+ };
29
+ const OPERATORS = [
30
+ "=",
31
+ "!=",
32
+ ">",
33
+ ">=",
34
+ "<",
35
+ "<=",
36
+ "=?",
37
+ "in",
38
+ "not in",
39
+ "like",
40
+ "not like",
41
+ "ilike",
42
+ "not ilike",
43
+ "=like",
44
+ "=ilike",
45
+ "any",
46
+ "not any",
47
+ ];
48
+ const DOMAIN = {
49
+ type: "array",
50
+ maxItems: 100,
51
+ description:
52
+ 'Odoo domain: a list of [field, operator, value] conditions, all of which must hold. Put "|" before two conditions for OR, "!" before one for NOT. A field may follow relations with dots, at most 4 fields long (partner_id.country_id.code).',
53
+ items: {
54
+ anyOf: [
55
+ { type: "string", enum: ["&", "|", "!"] },
56
+ {
57
+ type: "array",
58
+ minItems: 3,
59
+ maxItems: 3,
60
+ prefixItems: [
61
+ // At most 4 hops: the data API refuses longer paths.
62
+ {
63
+ type: "string",
64
+ pattern: "^[a-z_][a-z0-9_]*(\\.[a-z_][a-z0-9_]*){0,3}$",
65
+ maxLength: 256,
66
+ },
67
+ { type: "string", enum: OPERATORS },
68
+ {},
69
+ ],
70
+ },
71
+ ],
72
+ },
73
+ };
74
+ // Sort orders as the data API accepts them: fields of the model for search,
75
+ // groupby fields, aggregates or __count for group.
76
+ const ORDER_ITEM = "( (asc|desc|ASC|DESC))?";
77
+ const SEARCH_ORDER = {
78
+ type: "string",
79
+ maxLength: 200,
80
+ pattern: `^[a-z_][a-z0-9_]*${ORDER_ITEM}(, ?[a-z_][a-z0-9_]*${ORDER_ITEM}){0,9}$`,
81
+ description: 'Sort order on fields of the model, for example "date desc, id".',
82
+ };
83
+ const GROUP_KEY = "(__count|[a-z_][a-z0-9_]*(:[a-z_]+)?)";
84
+ const GROUP_ORDER = {
85
+ type: "string",
86
+ maxLength: 200,
87
+ pattern: `^${GROUP_KEY}${ORDER_ITEM}(, ?${GROUP_KEY}${ORDER_ITEM}){0,9}$`,
88
+ description: 'Sort order on groupby or aggregate items, for example "amount_total:sum desc".',
89
+ };
90
+ const RECORDS = { type: "array", items: { type: "object" } };
91
+
92
+ function objectSchema(properties, required) {
93
+ return { type: "object", properties, required, additionalProperties: false };
94
+ }
95
+
96
+ function annotations(title) {
97
+ return {
98
+ title,
99
+ readOnlyHint: true,
100
+ destructiveHint: false,
101
+ idempotentHint: true,
102
+ openWorldHint: true,
103
+ };
104
+ }
105
+
106
+ const RIGHTS =
107
+ "Odoo runs every call as the signed-in user: results contain only what that user may read under Odoo's access rights and record rules, so another user may see different records.";
108
+ // Results follow one user's Odoo access, knowledge written from them is read
109
+ // by everyone.
110
+ const SHARING =
111
+ "These results are limited to the signed-in user's own Odoo access, but knowledge written from them is readable by every MCP user: record conclusions and aggregates, not personal or confidential values (names of individuals, salaries, health or contact details) that other readers could not see in Odoo.";
112
+ const FIELD_FLAGS =
113
+ "Filter only on fields odoo_describe_model marks searchable, sort only on sortable ones and group only on groupable ones.";
114
+ const EXPLAINED =
115
+ "When Odoo refuses a call (invalid_params, unknown_model, access_denied), the error's details name the parameter (field), the reason and a hint: read them and correct the call.";
116
+ const LOOK_UP_FIRST =
117
+ "Before searching, look up the model in the generated `odoo` knowledge bundle (its models/<model> concept lists the fields, relations and access rules) or call odoo_describe_model, so that you use real field names.";
118
+
119
+ const TOOLS = [
120
+ {
121
+ name: "odoo_find_models",
122
+ op: "models",
123
+ title: "Find Odoo models",
124
+ description: [
125
+ "Find the Odoo models (business object types, such as res.partner for contacts) that the signed-in user may read, matching a word in the technical name or the label.",
126
+ "Use it when you do not know which model holds the data. The `odoo` knowledge bundle describes the models too, with their fields and access rules.",
127
+ "total is the number of matching models and truncated is true when more exist than limit; page with offset.",
128
+ "Odoo sometimes pairs a restricted model with a public one that more users may read, for example hr.employee.public next to hr.employee: when a model is denied, look for such a public counterpart.",
129
+ RIGHTS,
130
+ ].join(" "),
131
+ inputSchema: objectSchema(
132
+ {
133
+ query: {
134
+ type: "string",
135
+ maxLength: 200,
136
+ description: "Word to look for in the model name or label; omit to list models.",
137
+ },
138
+ limit: { type: "integer", minimum: 1, maximum: 50, description: "At most 50; default 50." },
139
+ offset: {
140
+ type: "integer",
141
+ minimum: 0,
142
+ maximum: 100000,
143
+ description: "Models to skip, for paging.",
144
+ },
145
+ },
146
+ [],
147
+ ),
148
+ outputSchema: {
149
+ type: "object",
150
+ properties: {
151
+ models: {
152
+ type: "array",
153
+ items: {
154
+ type: "object",
155
+ properties: { model: { type: "string" }, name: { type: "string" } },
156
+ required: ["model", "name"],
157
+ },
158
+ },
159
+ total: { type: "integer" },
160
+ truncated: { type: "boolean" },
161
+ },
162
+ required: ["models"],
163
+ },
164
+ params: (args) => ({ ...args }),
165
+ // Older servers answer with the bare list, newer ones with { models,
166
+ // total, truncated }.
167
+ result: (value) =>
168
+ Array.isArray(value) ? { models: value } : Array.isArray(value?.models) ? value : null,
169
+ },
170
+ {
171
+ name: "odoo_describe_model",
172
+ op: "describe",
173
+ title: "Describe an Odoo model",
174
+ description: [
175
+ "List the fields of one Odoo model as the signed-in user sees them: technical name, label, type, related model, whether it is required or read-only, selection values and help text.",
176
+ "Call it, or read the model's concept in the `odoo` knowledge bundle, before odoo_search, odoo_read, odoo_group or odoo_sql. Fields the user may not read are left out.",
177
+ "When the server provides it, table is the model's database table for odoo_sql; it is not always the model name with dots replaced by underscores.",
178
+ "Each field says whether it is stored, searchable (usable in a domain), sortable (usable in order) and groupable (usable in odoo_group's groupby); use fields only where they are marked so.",
179
+ EXPLAINED,
180
+ ].join(" "),
181
+ inputSchema: objectSchema({ model: MODEL }, ["model"]),
182
+ outputSchema: {
183
+ type: "object",
184
+ properties: {
185
+ model: { type: "string" },
186
+ name: { type: "string" },
187
+ table: { type: ["string", "null"] },
188
+ fields: {
189
+ type: "array",
190
+ items: {
191
+ type: "object",
192
+ properties: {
193
+ name: { type: "string" },
194
+ string: { type: "string" },
195
+ type: { type: "string" },
196
+ relation: { type: "string" },
197
+ required: { type: "boolean" },
198
+ readonly: { type: "boolean" },
199
+ stored: { type: "boolean" },
200
+ searchable: { type: "boolean" },
201
+ sortable: { type: "boolean" },
202
+ groupable: { type: "boolean" },
203
+ selection: { type: "array" },
204
+ help: { type: "string" },
205
+ },
206
+ required: ["name", "type"],
207
+ },
208
+ },
209
+ },
210
+ required: ["model", "fields"],
211
+ },
212
+ params: (args) => ({ ...args }),
213
+ result: objectResult,
214
+ },
215
+ {
216
+ name: "odoo_search",
217
+ op: "search",
218
+ title: "Search Odoo records",
219
+ description: [
220
+ "Search records of one Odoo model and return the requested fields of each.",
221
+ LOOK_UP_FIRST,
222
+ FIELD_FLAGS,
223
+ EXPLAINED,
224
+ 'The domain is a list of [field, operator, value] conditions that must all hold; put "|" before two conditions for OR. Examples: [["state", "=", "done"], ["date", ">=", "2026-01-01"]] and ["|", ["name", "ilike", "chair"], ["default_code", "=", "A100"]].',
225
+ 'Operators: =, !=, >, >=, <, <=, in, not in, like, ilike, not ilike, =like, =ilike, any; the hierarchy operators child_of and parent_of are not available. A text condition on a relation, such as ["partner_id", "ilike", "north"], matches the related record\'s display name among records the user may read; compare ids for exact matches. A field path follows at most 4 fields (partner_id.country_id.code). A many2one value comes back as [id, display name].',
226
+ "On models whose reads hide part of a record (such as private calendar events), filters, sorting and grouping may use only id and the public fields; others are refused with invalid_params.",
227
+ "count is the number of matching records; truncated is true when more exist than limit (at most 200); page with offset. For totals use odoo_group instead of adding up pages.",
228
+ RIGHTS,
229
+ SHARING,
230
+ ].join(" "),
231
+ inputSchema: objectSchema(
232
+ {
233
+ model: MODEL,
234
+ domain: DOMAIN,
235
+ fields: FIELDS,
236
+ order: SEARCH_ORDER,
237
+ limit: {
238
+ type: "integer",
239
+ minimum: 1,
240
+ maximum: 200,
241
+ description: "At most 200; default 80.",
242
+ },
243
+ offset: { type: "integer", minimum: 0, maximum: 1000000, description: "Records to skip." },
244
+ },
245
+ ["model", "fields"],
246
+ ),
247
+ outputSchema: {
248
+ type: "object",
249
+ properties: {
250
+ records: RECORDS,
251
+ count: { type: "integer" },
252
+ truncated: { type: "boolean" },
253
+ },
254
+ required: ["records"],
255
+ },
256
+ params: (args) => ({ domain: [], limit: 80, ...args }),
257
+ result: objectResult,
258
+ },
259
+ {
260
+ name: "odoo_read",
261
+ op: "read",
262
+ title: "Read Odoo records",
263
+ description: [
264
+ "Read the requested fields of Odoo records by id (at most 100), for example ids returned by odoo_search or the id in a many2one value [id, display name].",
265
+ LOOK_UP_FIRST,
266
+ EXPLAINED,
267
+ "Ids that do not exist and records the signed-in user may not read are silently left out, so fewer records than ids may come back.",
268
+ SHARING,
269
+ ].join(" "),
270
+ inputSchema: objectSchema(
271
+ {
272
+ model: MODEL,
273
+ ids: {
274
+ type: "array",
275
+ items: { type: "integer", minimum: 1 },
276
+ minItems: 1,
277
+ maxItems: 100,
278
+ description: "Record ids, at most 100.",
279
+ },
280
+ fields: FIELDS,
281
+ },
282
+ ["model", "ids", "fields"],
283
+ ),
284
+ outputSchema: {
285
+ type: "object",
286
+ properties: { records: RECORDS },
287
+ required: ["records"],
288
+ },
289
+ params: (args) => ({ ...args }),
290
+ result: objectResult,
291
+ },
292
+ {
293
+ name: "odoo_group",
294
+ op: "group",
295
+ title: "Group and total Odoo records",
296
+ description: [
297
+ "Group the records of one Odoo model and compute totals, like a pivot table.",
298
+ LOOK_UP_FIRST,
299
+ FIELD_FLAGS,
300
+ EXPLAINED,
301
+ 'groupby lists fields; a date field needs a granularity: "date:month" (day, week, month, quarter, year, or hour for date-times). aggregates are written "field:function": sum, avg, min or max on numeric fields, count or count_distinct on stored fields, and "__count" counts records. Example: groupby ["partner_id"], aggregates ["amount_total:sum", "__count"], order "amount_total:sum desc".',
302
+ "Each group carries its groupby values and aggregates: a relation as [id, display name], a date bucket as [start, label].",
303
+ "The domain has the same syntax as in odoo_search, with paths of at most 4 fields. At most 500 groups.",
304
+ `${RIGHTS} Totals therefore cover only the records the user may read.`,
305
+ SHARING,
306
+ ].join(" "),
307
+ inputSchema: objectSchema(
308
+ {
309
+ model: MODEL,
310
+ domain: DOMAIN,
311
+ groupby: {
312
+ type: "array",
313
+ items: {
314
+ type: "string",
315
+ pattern: "^[a-z_][a-z0-9_]*(:(hour|day|week|month|quarter|year))?$",
316
+ maxLength: 140,
317
+ },
318
+ minItems: 1,
319
+ maxItems: 5,
320
+ description: 'Fields to group by, for example ["partner_id", "date:month"].',
321
+ },
322
+ aggregates: {
323
+ type: "array",
324
+ items: {
325
+ type: "string",
326
+ pattern: "^(__count|[a-z_][a-z0-9_]*:(sum|avg|min|max|count|count_distinct))$",
327
+ maxLength: 160,
328
+ },
329
+ minItems: 1,
330
+ maxItems: 20,
331
+ description: 'Totals to compute, for example ["amount_total:sum", "__count"].',
332
+ },
333
+ order: GROUP_ORDER,
334
+ limit: {
335
+ type: "integer",
336
+ minimum: 1,
337
+ maximum: 500,
338
+ description: "At most 500; default 80.",
339
+ },
340
+ },
341
+ ["model", "groupby", "aggregates"],
342
+ ),
343
+ outputSchema: {
344
+ type: "object",
345
+ properties: { groups: RECORDS },
346
+ required: ["groups"],
347
+ },
348
+ params: (args) => ({ domain: [], limit: 80, ...args }),
349
+ result: objectResult,
350
+ },
351
+ {
352
+ name: "odoo_sql",
353
+ op: "sql",
354
+ scope: "odoo.sql",
355
+ title: "Query Odoo with SQL",
356
+ description: [
357
+ "Run one read-only PostgreSQL query on Odoo's tables: a single SELECT, VALUES or TABLE statement; no INTO, FOR UPDATE, writes or several statements.",
358
+ "The query sees exactly the rows and fields the signed-in user may read in Odoo (access rights, record rules, field groups, all of the user's companies); other rows are absent, not hidden behind an error.",
359
+ "Write it against database table and column names. Find them in the generated `odoo` knowledge bundle or with odoo_describe_model, whose result gives the model's table when the server provides it: a table is not always the model name with dots replaced by underscores (res.partner is res_partner, but check). One-to-many fields are not columns; join the other table. A many-to-many table holds only pairs whose both records the user may read.",
360
+ "Name the columns you need instead of SELECT *: only named columns are copied for the query, so it runs faster, and large tables may otherwise exceed the copy limit (result_too_large).",
361
+ "Values come as JSON: numbers for numeric columns, ISO 8601 strings for dates and times, seconds for intervals, \\x… hexadecimal for bytea. limit is 1 to 1000 rows (default 100); truncated is true when there are more. tables lists the tables copied, with their model and the rows the user may read.",
362
+ "A query_error carries PostgreSQL's sqlstate, position and message so you can fix the query: 0A000 means the statement is not allowed, 42601 a syntax error, 42P01 a table that is unknown, hidden or not readable (deliberately the same answer).",
363
+ "Odoo runs only a few queries per user at once (often one): a query sent while others run waits up to about 12 seconds for its turn, then fails with too_many_requests, so send long queries one after another. unavailable means SQL is not set up on this server. Prefer odoo_search and odoo_group for simple lookups and totals.",
364
+ SHARING,
365
+ ].join(" "),
366
+ inputSchema: objectSchema(
367
+ {
368
+ query: {
369
+ type: "string",
370
+ minLength: 1,
371
+ maxLength: 20000,
372
+ description: "One SELECT, VALUES or TABLE statement, at most 20000 characters.",
373
+ },
374
+ limit: {
375
+ type: "integer",
376
+ minimum: 1,
377
+ maximum: 1000,
378
+ description: "Rows to return, 1 to 1000; default 100.",
379
+ },
380
+ },
381
+ ["query"],
382
+ ),
383
+ outputSchema: {
384
+ type: "object",
385
+ properties: {
386
+ columns: {
387
+ type: "array",
388
+ items: {
389
+ type: "object",
390
+ properties: { name: { type: "string" }, type: { type: "string" } },
391
+ required: ["name", "type"],
392
+ },
393
+ },
394
+ rows: { type: "array", items: { type: "array" } },
395
+ truncated: { type: "boolean" },
396
+ elapsedMs: { type: "integer" },
397
+ tables: {
398
+ type: "array",
399
+ items: {
400
+ type: "object",
401
+ properties: {
402
+ name: { type: "string" },
403
+ model: { type: ["string", "null"] },
404
+ rows: { type: "integer" },
405
+ },
406
+ required: ["name", "model", "rows"],
407
+ },
408
+ },
409
+ },
410
+ required: ["columns", "rows", "truncated", "tables"],
411
+ },
412
+ params: (args) => ({ limit: 100, ...args }),
413
+ result: objectResult,
414
+ },
415
+ ];
416
+
417
+ function objectResult(value) {
418
+ return value && typeof value === "object" && !Array.isArray(value) ? value : null;
419
+ }
420
+
421
+ function validateConfig(value = {}) {
422
+ const diagnostics = [];
423
+ const report = (code, field, message) => diagnostics.push({ code, field, message });
424
+ const plain = value && typeof value === "object" && !Array.isArray(value);
425
+ const input = plain ? value : {};
426
+ if (!plain) report("invalid_config", "config", "Tool pack config must be an object.");
427
+ for (const key of Object.keys(input)
428
+ .filter((name) => !CONFIG_KEYS.has(name))
429
+ .sort()) {
430
+ report("unknown_config_key", key, `Unsupported Odoo tool pack config key: ${key}.`);
431
+ }
432
+ let url = null;
433
+ if (input.url === undefined) {
434
+ report("missing_url", "url", "url is required.");
435
+ } else {
436
+ try {
437
+ url = normalizeBaseUrl(input.url);
438
+ } catch {
439
+ report(
440
+ "invalid_url",
441
+ "url",
442
+ "url must be an https URL (http only for a loopback host) without credentials, query, or fragment.",
443
+ );
444
+ }
445
+ }
446
+ const env = (key) => {
447
+ const name = input[key];
448
+ if (name === undefined) report(`missing_${snake(key)}`, key, `${key} is required.`);
449
+ else if (typeof name !== "string" || !ENV_NAME.test(name)) {
450
+ report(`invalid_${snake(key)}`, key, `${key} must be an environment-variable name.`);
451
+ }
452
+ return typeof name === "string" ? name : null;
453
+ };
454
+ const clientIdEnv = env("clientIdEnv");
455
+ const clientSecretEnv = env("clientSecretEnv");
456
+ if (clientIdEnv && clientIdEnv === clientSecretEnv) {
457
+ report(
458
+ "same_credential_env",
459
+ "clientSecretEnv",
460
+ "clientIdEnv and clientSecretEnv must differ.",
461
+ );
462
+ }
463
+ const timeoutMs = input.timeoutMs === undefined ? DEFAULT_TIMEOUT_MS : input.timeoutMs;
464
+ if (!Number.isInteger(timeoutMs) || timeoutMs < 1000 || timeoutMs > 120000) {
465
+ report("invalid_timeout_ms", "timeoutMs", "timeoutMs must be an integer from 1000 to 120000.");
466
+ }
467
+ return {
468
+ valid: diagnostics.length === 0,
469
+ config: { url, clientIdEnv, clientSecretEnv, timeoutMs },
470
+ diagnostics,
471
+ };
472
+ }
473
+
474
+ function snake(key) {
475
+ return key.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`);
476
+ }
477
+
478
+ // Runs one tool: arguments are checked against the schema before anything
479
+ // else, the call needs the signed-in user's token, and the credentials are
480
+ // read through getSecret for this call only.
481
+ async function runTool(tool, args, context = {}, dependencies = {}) {
482
+ const input = args === undefined ? {} : args;
483
+ const path = violation(tool.inputSchema, input);
484
+ if (path !== null) throw new OdooToolError("invalid_arguments", { field: path });
485
+ if (typeof context.subjectToken !== "string" || !context.subjectToken) {
486
+ throw new OdooToolError("subject_token_required");
487
+ }
488
+ const validation = validateConfig(context.config);
489
+ if (!validation.valid) throw new OdooToolError("invalid_config");
490
+ const { config } = validation;
491
+ if (typeof context.getSecret !== "function") {
492
+ throw new OdooToolError("client_credentials_unavailable");
493
+ }
494
+ let clientId;
495
+ let clientSecret;
496
+ try {
497
+ clientId = await context.getSecret(config.clientIdEnv);
498
+ clientSecret = await context.getSecret(config.clientSecretEnv);
499
+ } catch {
500
+ throw new OdooToolError("client_credentials_unavailable");
501
+ }
502
+ const result = await callDataApi({
503
+ url: config.url,
504
+ op: tool.op,
505
+ clientId,
506
+ clientSecret,
507
+ token: context.subjectToken,
508
+ params: tool.params(input),
509
+ signal: context.signal,
510
+ timeoutMs: config.timeoutMs,
511
+ maxResponseBytes: dependencies.maxResponseBytes,
512
+ busyWaitMs: dependencies.busyWaitMs,
513
+ fetch: dependencies.fetch,
514
+ });
515
+ const shaped = tool.result(result);
516
+ if (!shaped) throw new OdooToolError("invalid_response");
517
+ return shaped;
518
+ }
519
+
520
+ module.exports = { SCOPE, TOOLS, annotations, runTool, validateConfig };