@webiny/mcp 6.2.0 → 6.3.0-beta.1

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.
@@ -2,7 +2,7 @@
2
2
  name: webiny-admin-catalog
3
3
  context: webiny-api
4
4
  description: >
5
- admin — 16 abstractions.
5
+ admin — 19 abstractions.
6
6
  ---
7
7
 
8
8
  # admin
@@ -101,6 +101,21 @@ is automatically removed from DevTools.
101
101
  **Import:** `import { Routes } from "webiny/admin"`
102
102
  **Source:** `@webiny/app-admin/routes.ts`
103
103
 
104
+ ---
105
+ **Name:** `Tool`
106
+ **Import:** `import { Tool } from "webiny/admin"`
107
+ **Source:** `@webiny/app-admin/features/tools/index.ts`
108
+
109
+ ---
110
+ **Name:** `ToolPipelineRunner`
111
+ **Import:** `import { ToolPipelineRunner } from "webiny/admin"`
112
+ **Source:** `@webiny/app-admin/features/tools/index.ts`
113
+
114
+ ---
115
+ **Name:** `ToolsFeature`
116
+ **Import:** `import { ToolsFeature } from "webiny/admin"`
117
+ **Source:** `@webiny/app-admin/features/tools/index.ts`
118
+
104
119
  ---
105
120
  **Name:** `useFeature`
106
121
  **Import:** `import { useFeature } from "webiny/admin"`
@@ -2,7 +2,7 @@
2
2
  name: webiny-api-catalog
3
3
  context: webiny-api
4
4
  description: >
5
- api — 14 abstractions.
5
+ api — 21 abstractions.
6
6
  ---
7
7
 
8
8
  # api
@@ -15,6 +15,30 @@ description: >
15
15
 
16
16
  ## Abstractions
17
17
 
18
+ ---
19
+ **Name:** `Ai`
20
+ **Import:** `import { Ai } from "webiny/api"`
21
+ **Source:** `@webiny/api-core/features/ai/index.ts`
22
+ **Description:** Interact with AI language models using registered providers.
23
+
24
+ ---
25
+ **Name:** `AiConnectionFactory`
26
+ **Import:** `import { AiConnectionFactory } from "webiny/api"`
27
+ **Source:** `@webiny/api-core/features/ai/index.ts`
28
+ **Description:** Factory that asynchronously produces an AiConnection.
29
+
30
+ ---
31
+ **Name:** `AiSdk`
32
+ **Import:** `import { AiSdk } from "webiny/api"`
33
+ **Source:** `@webiny/api-core/features/ai/index.ts`
34
+ **Description:** A single AI SDK instance (e.g. OpenAI, Anthropic) that resolves model instances.
35
+
36
+ ---
37
+ **Name:** `AiSdkFactory`
38
+ **Import:** `import { AiSdkFactory } from "webiny/api"`
39
+ **Source:** `@webiny/api-core/features/ai/index.ts`
40
+ **Description:** Factory that asynchronously initialises an AI SDK. Register one per provider namespace.
41
+
18
42
  ---
19
43
  **Name:** `BaseError`
20
44
  **Import:** `import { BaseError } from "webiny/api"`
@@ -58,6 +82,12 @@ description: >
58
82
  **Source:** `@webiny/api-core/features/eventPublisher/index.ts`
59
83
  **Description:** Base class for all domain events.
60
84
 
85
+ ---
86
+ **Name:** `Encryption`
87
+ **Import:** `import { Encryption } from "webiny/api"`
88
+ **Source:** `@webiny/api-core/features/encryption/index.ts`
89
+ **Description:** Symmetric encryption and decryption using a configured secret key.
90
+
61
91
  ---
62
92
  **Name:** `EventPublisher`
63
93
  **Import:** `import { EventPublisher } from "webiny/api"`
@@ -70,6 +100,18 @@ description: >
70
100
  **Source:** `@webiny/api-core/features/keyValueStore/index.ts`
71
101
  **Description:** Global (non-tenant-scoped) key-value store.
72
102
 
103
+ ---
104
+ **Name:** `IAiConnection`
105
+ **Kind:** type
106
+ **Import:** `import type { IAiConnection } from "webiny/api"`
107
+ **Source:** `@webiny/api-core/features/ai/index.ts`
108
+
109
+ ---
110
+ **Name:** `IAiConnectionInline`
111
+ **Kind:** type
112
+ **Import:** `import type { IAiConnectionInline } from "webiny/api"`
113
+ **Source:** `@webiny/api-core/features/ai/index.ts`
114
+
73
115
  ---
74
116
  **Name:** `KeyValueStore`
75
117
  **Import:** `import { KeyValueStore } from "webiny/api"`
@@ -6,9 +6,10 @@ description: >
6
6
  Use this skill when the developer is building a Next.js, Vue, Node.js, or any external app
7
7
  that needs to fetch or write content to Webiny, set up the SDK, use the Result pattern,
8
8
  list/get/create/update/publish entries, filter and sort queries, use TypeScript generics
9
- for type safety, work with the File Manager, list languages, or create API keys programmatically.
9
+ for type safety, work with the File Manager, list languages, trigger or monitor background tasks,
10
+ or create API keys programmatically.
10
11
  Covers read vs preview mode, the `values` wrapper requirement, correct method names,
11
- and the `fields` required parameter.
12
+ the `fields` required parameter, and background task management via `sdk.tasks`.
12
13
  ---
13
14
 
14
15
  # Webiny SDK
@@ -291,8 +292,8 @@ The `Language` type:
291
292
  ```typescript
292
293
  interface Language {
293
294
  id: string;
294
- code: string; // e.g. "en-US"
295
- name: string; // e.g. "English (US)"
295
+ code: string; // e.g. "en-US"
296
+ name: string; // e.g. "English (US)"
296
297
  direction?: "ltr" | "rtl";
297
298
  isDefault?: boolean;
298
299
  }
@@ -344,40 +345,158 @@ Register (**YOU MUST include the `.ts` file extension in the `src` prop** — om
344
345
  <Api.Extension src={"/extensions/MyApiKey.ts"} />
345
346
  ```
346
347
 
348
+ ## Background Tasks
349
+
350
+ `webiny.tasks` wraps the Background Tasks GraphQL API. All methods return a `Result` and never throw.
351
+
352
+ ### List Task Definitions
353
+
354
+ Returns all registered task definitions — use this to discover valid `definition` IDs before triggering.
355
+
356
+ ```typescript
357
+ const result = await webiny.tasks.listDefinitions();
358
+
359
+ if (result.isOk()) {
360
+ // result.value: TaskDefinition[]
361
+ for (const def of result.value) {
362
+ console.log(def.id, def.title, def.description);
363
+ }
364
+ }
365
+ ```
366
+
367
+ ### List Task Runs
368
+
369
+ ```typescript
370
+ const result = await webiny.tasks.listTasks();
371
+
372
+ if (result.isOk()) {
373
+ // result.value: TaskRun[]
374
+ for (const task of result.value) {
375
+ console.log(task.id, task.taskStatus, task.definitionId);
376
+ }
377
+ }
378
+ ```
379
+
380
+ ### List Task Logs
381
+
382
+ Optionally filter by a specific task run ID:
383
+
384
+ ```typescript
385
+ // All logs
386
+ const result = await webiny.tasks.listLogs();
387
+
388
+ // Logs for a specific task run
389
+ const result = await webiny.tasks.listLogs({
390
+ where: { task: "yourTaskRunId" }
391
+ });
392
+
393
+ if (result.isOk()) {
394
+ for (const log of result.value) {
395
+ for (const item of log.items) {
396
+ console.log(`[${item.type}] ${item.message}`);
397
+ }
398
+ }
399
+ }
400
+ ```
401
+
402
+ ### Trigger a Task
403
+
404
+ ```typescript
405
+ const result = await webiny.tasks.triggerTask({
406
+ definition: "myTaskDefinitionId",
407
+ input: {
408
+ someVariable: "someValue",
409
+ anotherVariable: 42
410
+ }
411
+ });
412
+
413
+ if (result.isOk()) {
414
+ const task = result.value; // TaskRun
415
+ console.log(task.id, task.taskStatus, task.executionName);
416
+ }
417
+ ```
418
+
419
+ ### Abort a Task
420
+
421
+ The task stops at its next safe checkpoint.
422
+
423
+ ```typescript
424
+ const result = await webiny.tasks.abortTask({
425
+ id: "yourTaskRunId",
426
+ message: "Stopped by user request" // optional
427
+ });
428
+
429
+ if (result.isOk()) {
430
+ console.log(result.value.taskStatus); // "aborted"
431
+ }
432
+ ```
433
+
434
+ ### Background Task Types
435
+
436
+ ```typescript
437
+ import type { TaskDefinition, TaskRun, TaskLog, TaskLogItem, TaskStatus } from "@webiny/sdk";
438
+
439
+ type TaskStatus = "pending" | "running" | "completed" | "failed" | "aborted" | "stopped";
440
+
441
+ interface TaskDefinition {
442
+ id: string;
443
+ title: string;
444
+ description?: string;
445
+ }
446
+
447
+ interface TaskRun {
448
+ id: string;
449
+ definitionId: string;
450
+ taskStatus: TaskStatus;
451
+ input?: unknown;
452
+ output?: unknown;
453
+ startedOn?: string;
454
+ finishedOn?: string;
455
+ executionName?: string;
456
+ iterations?: number;
457
+ parentId?: string;
458
+ }
459
+ ```
460
+
347
461
  ## SDK Modules Reference
348
462
 
349
- | Module | Webiny App | What You Can Do |
350
- | ---------------------- | ------------- | --------------------------------------------------------------------- |
351
- | `webiny.cms` | Headless CMS | List, get, create, update, publish, unpublish, delete entry revisions |
352
- | `webiny.fileManager` | File Manager | List, upload, and manage files and folders |
353
- | `webiny.tenantManager` | Multi-tenancy | Create, install, enable, disable tenants |
354
- | `webiny.languages` | Languages | List enabled languages (id, code, name, direction, isDefault) |
463
+ | Module | Webiny App | What You Can Do |
464
+ | ---------------------- | ---------------- | --------------------------------------------------------------------- |
465
+ | `webiny.cms` | Headless CMS | List, get, create, update, publish, unpublish, delete entry revisions |
466
+ | `webiny.fileManager` | File Manager | List, upload, and manage files and folders |
467
+ | `webiny.tenantManager` | Multi-tenancy | Create, install, enable, disable tenants |
468
+ | `webiny.languages` | Languages | List enabled languages (id, code, name, direction, isDefault) |
469
+ | `webiny.tasks` | Background Tasks | Trigger, abort, list task runs, definitions, and logs |
355
470
 
356
471
  ## Common Mistakes
357
472
 
358
- | Mistake | Correct |
359
- | --------------------------- | --------------------------------------- |
360
- | `data: { name: "..." }` | `data: { values: { name: "..." } }` |
361
- | `updateEntry(...)` | `updateEntryRevision(...)` |
362
- | `publishEntry(...)` | `publishEntryRevision(...)` |
363
- | `unpublishEntry(...)` | `unpublishEntryRevision(...)` |
364
- | `sort: ["values.name_ASC"]` | `sort: { "values.name": "asc" }` |
365
- | `getEntry({ id: "..." })` | `getEntry({ where: { id: "..." } })` |
366
- | Omitting `fields` | Always provide `fields: [...]` |
367
- | Trailing slash in endpoint | Remove trailing slash from endpoint URL |
473
+ | Mistake | Correct |
474
+ | ---------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
475
+ | `data: { name: "..." }` | `data: { values: { name: "..." } }` |
476
+ | `updateEntry(...)` | `updateEntryRevision(...)` |
477
+ | `publishEntry(...)` | `publishEntryRevision(...)` |
478
+ | `unpublishEntry(...)` | `unpublishEntryRevision(...)` |
479
+ | `sort: ["values.name_ASC"]` | `sort: { "values.name": "asc" }` |
480
+ | `getEntry({ id: "..." })` | `getEntry({ where: { id: "..." } })` |
481
+ | Omitting `fields` | Always provide `fields: [...]` |
482
+ | Trailing slash in endpoint | Remove trailing slash from endpoint URL |
483
+ | `triggerTask` with unknown `definition` string | Use an ID returned by `listDefinitions()` — the GQL schema validates it against `WebinyBackgroundTaskDefinitionEnum!` |
368
484
 
369
485
  ## Quick Reference
370
486
 
371
487
  ```
372
- Install: npm install @webiny/sdk
373
- Import: import { Webiny } from "@webiny/sdk";
374
- Type import: import type { CmsEntryData } from "@webiny/sdk";
375
- Initialize: new Webiny({ token, endpoint, tenant })
376
- Result check: result.isOk() -> result.value.data / result.error.message
377
- API endpoint: yarn webiny info (in your Webiny project) -- NO trailing slash
378
- Preview mode: pass preview: true to listEntries / getEntry
379
- fields required: every method needs a fields: string[] array
380
- values wrapper: createEntry/updateEntryRevision data must use { values: { ... } }
488
+ Install: npm install @webiny/sdk
489
+ Import: import { Webiny } from "@webiny/sdk";
490
+ Type import: import type { CmsEntryData, TaskRun } from "@webiny/sdk";
491
+ Initialize: new Webiny({ token, endpoint, tenant })
492
+ Result check: result.isOk() -> result.value / result.error.message
493
+ API endpoint: yarn webiny info (in your Webiny project) -- NO trailing slash
494
+ Preview mode: pass preview: true to listEntries / getEntry
495
+ fields required: every CMS method needs a fields: string[] array
496
+ values wrapper: createEntry/updateEntryRevision data must use { values: { ... } }
497
+ Background tasks: webiny.tasks.triggerTask({ definition, input })
498
+ Abort task: webiny.tasks.abortTask({ id, message? })
499
+ Filter logs by task: webiny.tasks.listLogs({ where: { task: "id" } })
381
500
  ```
382
501
 
383
502
  ## Related Skills
@@ -341,7 +341,11 @@ createComponent(ProductListing, {
341
341
  name: "Custom/ProductListing",
342
342
  label: "Product Listing",
343
343
  inputs: [
344
- createTextInput({ name: "heading", label: "Section Heading", defaultValue: "Our Products" }),
344
+ createTextInput({
345
+ name: "heading",
346
+ label: "Section Heading",
347
+ defaultValue: "Our Products"
348
+ }),
345
349
  createTextInput({ name: "limit", label: "Number of products", defaultValue: "6" })
346
350
  ]
347
351
  });