@wootsup/yt-builder-mcp 0.2.0-alpha.2
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/LICENSE +21 -0
- package/README.md +221 -0
- package/bin/yt-builder-mcp.js +59 -0
- package/dist/auth.d.ts +39 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +93 -0
- package/dist/auth.js.map +1 -0
- package/dist/client.d.ts +84 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +151 -0
- package/dist/client.js.map +1 -0
- package/dist/clients/claude-code.d.ts +18 -0
- package/dist/clients/claude-code.d.ts.map +1 -0
- package/dist/clients/claude-code.js +53 -0
- package/dist/clients/claude-code.js.map +1 -0
- package/dist/clients/claude-desktop.d.ts +19 -0
- package/dist/clients/claude-desktop.d.ts.map +1 -0
- package/dist/clients/claude-desktop.js +56 -0
- package/dist/clients/claude-desktop.js.map +1 -0
- package/dist/clients/cline.d.ts +26 -0
- package/dist/clients/cline.d.ts.map +1 -0
- package/dist/clients/cline.js +80 -0
- package/dist/clients/cline.js.map +1 -0
- package/dist/clients/codex-cli.d.ts +42 -0
- package/dist/clients/codex-cli.d.ts.map +1 -0
- package/dist/clients/codex-cli.js +194 -0
- package/dist/clients/codex-cli.js.map +1 -0
- package/dist/clients/continue.d.ts +13 -0
- package/dist/clients/continue.d.ts.map +1 -0
- package/dist/clients/continue.js +52 -0
- package/dist/clients/continue.js.map +1 -0
- package/dist/clients/cursor.d.ts +12 -0
- package/dist/clients/cursor.d.ts.map +1 -0
- package/dist/clients/cursor.js +38 -0
- package/dist/clients/cursor.js.map +1 -0
- package/dist/clients/gemini-cli.d.ts +18 -0
- package/dist/clients/gemini-cli.d.ts.map +1 -0
- package/dist/clients/gemini-cli.js +44 -0
- package/dist/clients/gemini-cli.js.map +1 -0
- package/dist/clients/home.d.ts +14 -0
- package/dist/clients/home.d.ts.map +1 -0
- package/dist/clients/home.js +20 -0
- package/dist/clients/home.js.map +1 -0
- package/dist/clients/index.d.ts +52 -0
- package/dist/clients/index.d.ts.map +1 -0
- package/dist/clients/index.js +72 -0
- package/dist/clients/index.js.map +1 -0
- package/dist/clients/roo-code.d.ts +23 -0
- package/dist/clients/roo-code.d.ts.map +1 -0
- package/dist/clients/roo-code.js +69 -0
- package/dist/clients/roo-code.js.map +1 -0
- package/dist/clients/zed.d.ts +12 -0
- package/dist/clients/zed.d.ts.map +1 -0
- package/dist/clients/zed.js +41 -0
- package/dist/clients/zed.js.map +1 -0
- package/dist/errors/hints.d.ts +51 -0
- package/dist/errors/hints.d.ts.map +1 -0
- package/dist/errors/hints.js +95 -0
- package/dist/errors/hints.js.map +1 -0
- package/dist/errors/mask.d.ts +35 -0
- package/dist/errors/mask.d.ts.map +1 -0
- package/dist/errors/mask.js +49 -0
- package/dist/errors/mask.js.map +1 -0
- package/dist/errors/sanitize.d.ts +31 -0
- package/dist/errors/sanitize.d.ts.map +1 -0
- package/dist/errors/sanitize.js +90 -0
- package/dist/errors/sanitize.js.map +1 -0
- package/dist/errors.d.ts +42 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +61 -0
- package/dist/errors.js.map +1 -0
- package/dist/gateway/advanced-tool/discovery.d.ts +19 -0
- package/dist/gateway/advanced-tool/discovery.d.ts.map +1 -0
- package/dist/gateway/advanced-tool/discovery.js +53 -0
- package/dist/gateway/advanced-tool/discovery.js.map +1 -0
- package/dist/gateway/advanced-tool/domains.d.ts +42 -0
- package/dist/gateway/advanced-tool/domains.d.ts.map +1 -0
- package/dist/gateway/advanced-tool/domains.js +88 -0
- package/dist/gateway/advanced-tool/domains.js.map +1 -0
- package/dist/gateway/advanced-tool/execute.d.ts +29 -0
- package/dist/gateway/advanced-tool/execute.d.ts.map +1 -0
- package/dist/gateway/advanced-tool/execute.js +54 -0
- package/dist/gateway/advanced-tool/execute.js.map +1 -0
- package/dist/gateway/advanced-tool/index.d.ts +36 -0
- package/dist/gateway/advanced-tool/index.d.ts.map +1 -0
- package/dist/gateway/advanced-tool/index.js +39 -0
- package/dist/gateway/advanced-tool/index.js.map +1 -0
- package/dist/gateway/advanced-tool/register.d.ts +18 -0
- package/dist/gateway/advanced-tool/register.d.ts.map +1 -0
- package/dist/gateway/advanced-tool/register.js +62 -0
- package/dist/gateway/advanced-tool/register.js.map +1 -0
- package/dist/gateway/advanced-tool.d.ts +13 -0
- package/dist/gateway/advanced-tool.d.ts.map +1 -0
- package/dist/gateway/advanced-tool.js +13 -0
- package/dist/gateway/advanced-tool.js.map +1 -0
- package/dist/gateway/capturing-server.d.ts +117 -0
- package/dist/gateway/capturing-server.d.ts.map +1 -0
- package/dist/gateway/capturing-server.js +103 -0
- package/dist/gateway/capturing-server.js.map +1 -0
- package/dist/gateway/essentials.d.ts +49 -0
- package/dist/gateway/essentials.d.ts.map +1 -0
- package/dist/gateway/essentials.js +62 -0
- package/dist/gateway/essentials.js.map +1 -0
- package/dist/gateway/test-support.d.ts +41 -0
- package/dist/gateway/test-support.d.ts.map +1 -0
- package/dist/gateway/test-support.js +60 -0
- package/dist/gateway/test-support.js.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +77 -0
- package/dist/index.js.map +1 -0
- package/dist/install-skill.d.ts +35 -0
- package/dist/install-skill.d.ts.map +1 -0
- package/dist/install-skill.js +107 -0
- package/dist/install-skill.js.map +1 -0
- package/dist/platform/index.d.ts +49 -0
- package/dist/platform/index.d.ts.map +1 -0
- package/dist/platform/index.js +38 -0
- package/dist/platform/index.js.map +1 -0
- package/dist/server.d.ts +50 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +117 -0
- package/dist/server.js.map +1 -0
- package/dist/setup-cli.d.ts +100 -0
- package/dist/setup-cli.d.ts.map +1 -0
- package/dist/setup-cli.js +355 -0
- package/dist/setup-cli.js.map +1 -0
- package/dist/setup-prompts.d.ts +41 -0
- package/dist/setup-prompts.d.ts.map +1 -0
- package/dist/setup-prompts.js +142 -0
- package/dist/setup-prompts.js.map +1 -0
- package/dist/setup-token.d.ts +38 -0
- package/dist/setup-token.d.ts.map +1 -0
- package/dist/setup-token.js +106 -0
- package/dist/setup-token.js.map +1 -0
- package/dist/setup-wizard-defaults.d.ts +43 -0
- package/dist/setup-wizard-defaults.d.ts.map +1 -0
- package/dist/setup-wizard-defaults.js +160 -0
- package/dist/setup-wizard-defaults.js.map +1 -0
- package/dist/setup-wizard-handshake.d.ts +25 -0
- package/dist/setup-wizard-handshake.d.ts.map +1 -0
- package/dist/setup-wizard-handshake.js +103 -0
- package/dist/setup-wizard-handshake.js.map +1 -0
- package/dist/setup-wizard-types.d.ts +148 -0
- package/dist/setup-wizard-types.d.ts.map +1 -0
- package/dist/setup-wizard-types.js +11 -0
- package/dist/setup-wizard-types.js.map +1 -0
- package/dist/setup-wizard.d.ts +33 -0
- package/dist/setup-wizard.d.ts.map +1 -0
- package/dist/setup-wizard.js +166 -0
- package/dist/setup-wizard.js.map +1 -0
- package/dist/setup.d.ts +17 -0
- package/dist/setup.d.ts.map +1 -0
- package/dist/setup.js +33 -0
- package/dist/setup.js.map +1 -0
- package/dist/tools/elements/builders.d.ts +24 -0
- package/dist/tools/elements/builders.d.ts.map +1 -0
- package/dist/tools/elements/builders.js +150 -0
- package/dist/tools/elements/builders.js.map +1 -0
- package/dist/tools/elements/handlers-write.d.ts +48 -0
- package/dist/tools/elements/handlers-write.d.ts.map +1 -0
- package/dist/tools/elements/handlers-write.js +141 -0
- package/dist/tools/elements/handlers-write.js.map +1 -0
- package/dist/tools/elements/handlers.d.ts +56 -0
- package/dist/tools/elements/handlers.d.ts.map +1 -0
- package/dist/tools/elements/handlers.js +113 -0
- package/dist/tools/elements/handlers.js.map +1 -0
- package/dist/tools/elements/index.d.ts +28 -0
- package/dist/tools/elements/index.d.ts.map +1 -0
- package/dist/tools/elements/index.js +27 -0
- package/dist/tools/elements/index.js.map +1 -0
- package/dist/tools/elements.d.ts +13 -0
- package/dist/tools/elements.d.ts.map +1 -0
- package/dist/tools/elements.js +13 -0
- package/dist/tools/elements.js.map +1 -0
- package/dist/tools/elicitation.d.ts +87 -0
- package/dist/tools/elicitation.d.ts.map +1 -0
- package/dist/tools/elicitation.js +100 -0
- package/dist/tools/elicitation.js.map +1 -0
- package/dist/tools/format/elements-format.d.ts +34 -0
- package/dist/tools/format/elements-format.d.ts.map +1 -0
- package/dist/tools/format/elements-format.js +112 -0
- package/dist/tools/format/elements-format.js.map +1 -0
- package/dist/tools/format/health-format.d.ts +73 -0
- package/dist/tools/format/health-format.d.ts.map +1 -0
- package/dist/tools/format/health-format.js +178 -0
- package/dist/tools/format/health-format.js.map +1 -0
- package/dist/tools/format/inspection-format.d.ts +45 -0
- package/dist/tools/format/inspection-format.d.ts.map +1 -0
- package/dist/tools/format/inspection-format.js +125 -0
- package/dist/tools/format/inspection-format.js.map +1 -0
- package/dist/tools/format/pages-format.d.ts +39 -0
- package/dist/tools/format/pages-format.d.ts.map +1 -0
- package/dist/tools/format/pages-format.js +110 -0
- package/dist/tools/format/pages-format.js.map +1 -0
- package/dist/tools/format/sources-format.d.ts +25 -0
- package/dist/tools/format/sources-format.d.ts.map +1 -0
- package/dist/tools/format/sources-format.js +113 -0
- package/dist/tools/format/sources-format.js.map +1 -0
- package/dist/tools/health.d.ts +22 -0
- package/dist/tools/health.d.ts.map +1 -0
- package/dist/tools/health.js +147 -0
- package/dist/tools/health.js.map +1 -0
- package/dist/tools/index.d.ts +23 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +23 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/inspection.d.ts +14 -0
- package/dist/tools/inspection.d.ts.map +1 -0
- package/dist/tools/inspection.js +115 -0
- package/dist/tools/inspection.js.map +1 -0
- package/dist/tools/layout-flatten.d.ts +63 -0
- package/dist/tools/layout-flatten.d.ts.map +1 -0
- package/dist/tools/layout-flatten.js +95 -0
- package/dist/tools/layout-flatten.js.map +1 -0
- package/dist/tools/pages/builders.d.ts +14 -0
- package/dist/tools/pages/builders.d.ts.map +1 -0
- package/dist/tools/pages/builders.js +97 -0
- package/dist/tools/pages/builders.js.map +1 -0
- package/dist/tools/pages/handlers-read.d.ts +24 -0
- package/dist/tools/pages/handlers-read.d.ts.map +1 -0
- package/dist/tools/pages/handlers-read.js +141 -0
- package/dist/tools/pages/handlers-read.js.map +1 -0
- package/dist/tools/pages/handlers-write.d.ts +21 -0
- package/dist/tools/pages/handlers-write.d.ts.map +1 -0
- package/dist/tools/pages/handlers-write.js +52 -0
- package/dist/tools/pages/handlers-write.js.map +1 -0
- package/dist/tools/pages/index.d.ts +17 -0
- package/dist/tools/pages/index.d.ts.map +1 -0
- package/dist/tools/pages/index.js +17 -0
- package/dist/tools/pages/index.js.map +1 -0
- package/dist/tools/pages/schemas.d.ts +30 -0
- package/dist/tools/pages/schemas.d.ts.map +1 -0
- package/dist/tools/pages/schemas.js +30 -0
- package/dist/tools/pages/schemas.js.map +1 -0
- package/dist/tools/pages.d.ts +13 -0
- package/dist/tools/pages.d.ts.map +1 -0
- package/dist/tools/pages.js +13 -0
- package/dist/tools/pages.js.map +1 -0
- package/dist/tools/progress-phases.d.ts +46 -0
- package/dist/tools/progress-phases.d.ts.map +1 -0
- package/dist/tools/progress-phases.js +48 -0
- package/dist/tools/progress-phases.js.map +1 -0
- package/dist/tools/shared-schemas.d.ts +15 -0
- package/dist/tools/shared-schemas.d.ts.map +1 -0
- package/dist/tools/shared-schemas.js +30 -0
- package/dist/tools/shared-schemas.js.map +1 -0
- package/dist/tools/sources/builders.d.ts +13 -0
- package/dist/tools/sources/builders.d.ts.map +1 -0
- package/dist/tools/sources/builders.js +88 -0
- package/dist/tools/sources/builders.js.map +1 -0
- package/dist/tools/sources/handlers-bind.d.ts +26 -0
- package/dist/tools/sources/handlers-bind.d.ts.map +1 -0
- package/dist/tools/sources/handlers-bind.js +123 -0
- package/dist/tools/sources/handlers-bind.js.map +1 -0
- package/dist/tools/sources/handlers.d.ts +45 -0
- package/dist/tools/sources/handlers.d.ts.map +1 -0
- package/dist/tools/sources/handlers.js +84 -0
- package/dist/tools/sources/handlers.js.map +1 -0
- package/dist/tools/sources/index.d.ts +19 -0
- package/dist/tools/sources/index.d.ts.map +1 -0
- package/dist/tools/sources/index.js +18 -0
- package/dist/tools/sources/index.js.map +1 -0
- package/dist/tools/sources.d.ts +14 -0
- package/dist/tools/sources.d.ts.map +1 -0
- package/dist/tools/sources.js +14 -0
- package/dist/tools/sources.js.map +1 -0
- package/dist/tools/sparse-fields.d.ts +80 -0
- package/dist/tools/sparse-fields.d.ts.map +1 -0
- package/dist/tools/sparse-fields.js +144 -0
- package/dist/tools/sparse-fields.js.map +1 -0
- package/dist/tools/tool-builder/annotations.d.ts +22 -0
- package/dist/tools/tool-builder/annotations.d.ts.map +1 -0
- package/dist/tools/tool-builder/annotations.js +35 -0
- package/dist/tools/tool-builder/annotations.js.map +1 -0
- package/dist/tools/tool-builder/define.d.ts +31 -0
- package/dist/tools/tool-builder/define.d.ts.map +1 -0
- package/dist/tools/tool-builder/define.js +31 -0
- package/dist/tools/tool-builder/define.js.map +1 -0
- package/dist/tools/tool-builder/index.d.ts +28 -0
- package/dist/tools/tool-builder/index.d.ts.map +1 -0
- package/dist/tools/tool-builder/index.js +27 -0
- package/dist/tools/tool-builder/index.js.map +1 -0
- package/dist/tools/tool-builder/results.d.ts +59 -0
- package/dist/tools/tool-builder/results.d.ts.map +1 -0
- package/dist/tools/tool-builder/results.js +125 -0
- package/dist/tools/tool-builder/results.js.map +1 -0
- package/dist/tools/tool-builder/types.d.ts +82 -0
- package/dist/tools/tool-builder/types.d.ts.map +1 -0
- package/dist/tools/tool-builder/types.js +9 -0
- package/dist/tools/tool-builder/types.js.map +1 -0
- package/dist/tools/tool-builder.d.ts +16 -0
- package/dist/tools/tool-builder.d.ts.map +1 -0
- package/dist/tools/tool-builder.js +16 -0
- package/dist/tools/tool-builder.js.map +1 -0
- package/icon.png +0 -0
- package/manifest.json +63 -0
- package/package.json +81 -0
- package/skills/yootheme-builder/SKILL.md +582 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handlers-write.js","sourceRoot":"","sources":["../../../src/tools/elements/handlers-write.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EACH,YAAY,EACZ,sBAAsB,EACtB,WAAW,EACX,UAAU,GAGb,MAAM,oBAAoB,CAAC;AAG5B,wEAAwE;AAExE,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAClC,EAAE,MAAM,EAAuB,EAC/B,KAOC,EACD,KAAoB;IAEpB,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IAC7C,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC9D,MAAM,QAAQ,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,UAAU,CAAC,CAAC;IACzC,IAAI,CAAC;QACD,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,IAAI,CAC1B,UAAU,kBAAkB,CAAC,WAAW,CAAC,WAAW,EACpD,EAAE,IAAI,EAAE,IAAI,EAAE,CACjB,CAAC;QACF,MAAM,QAAQ,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,aAAa,CAAC,CAAC;QAC5C,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACT,OAAO,WAAW,CAAC;YACf,KAAK,EAAE,CAAC;YACR,OAAO,EAAE,KAAK;YACd,IAAI,EACA,iEAAiE;gBACjE,wEAAwE;SA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AAqF,EACrF,KAAoB;IAEpB,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IAC3D,MAAM,OAAO,GAAG,MAAM,oBAAoB,CAAC,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC;IAC5F,IAAI,OAAO;QAAE,OAAO,OAAO,CAAC;IAE5B,MAAM,OAAO,GAAG,iBAAiB,CAAC,YAAY,CAAC,CAAC;IAChD,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC9D,MAAM,QAAQ,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,UAAU,CAAC,CAAC;IACzC,IAAI,CAAC;QACD,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,MAAM,CAC5B,UAAU,kBAAkB,CAAC,WAAW,CAAC,aAAa,OAAO,EAAE,EAC/D,EAAE,IAAI,EAAE,CACX,CAAC;QACF,MAAM,QAAQ,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,aAAa,CAAC,CAAC;QAC5C,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACT,OAAO,WAAW,CAAC;YACf,KAAK,EAAE,CAAC;YACR,OAAO,EAAE,EAAE,WAAW,EAAE,YAAY,EAAE;YACtC,IAAI,EACA,qEAAqE;gBACrE,0EAA0E;SACjF,CAAC,CAAC;IACP,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Element-tool read handlers + shared types/schemas.
|
|
3
|
+
*
|
|
4
|
+
* Split out of the original `src/tools/elements.ts` (Wave G.4.0). Write
|
|
5
|
+
* handlers (add/update/move/clone/delete) live in `./handlers-write.ts`
|
|
6
|
+
* to keep each file under the 200-LoC budget.
|
|
7
|
+
*
|
|
8
|
+
* Handler responsibilities:
|
|
9
|
+
* - call the REST endpoint via `deps.client`,
|
|
10
|
+
* - map REST data to the toolkit output builders (`tableResult`,
|
|
11
|
+
* `detailResult`),
|
|
12
|
+
* - wrap in `structuredResult` to carry the typed
|
|
13
|
+
* `structuredContent` payload,
|
|
14
|
+
* - on error, return `errorResult` with `context` + `hint`.
|
|
15
|
+
*
|
|
16
|
+
* @license MIT
|
|
17
|
+
*/
|
|
18
|
+
import { z } from 'zod';
|
|
19
|
+
import { type RestClient } from '../../client.js';
|
|
20
|
+
import type { McpServerWithElicitation } from '../elicitation.js';
|
|
21
|
+
import { type ToolResult } from '../tool-builder.js';
|
|
22
|
+
export declare const ELEMENT_LIST_OUTPUT_SCHEMA: z.ZodObject<{
|
|
23
|
+
items: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
24
|
+
total: z.ZodNumber;
|
|
25
|
+
template_id: z.ZodString;
|
|
26
|
+
projected_fields: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
27
|
+
}, z.core.$strip>;
|
|
28
|
+
export declare const ELEMENT_GET_OUTPUT_SCHEMA: z.ZodObject<{
|
|
29
|
+
template_id: z.ZodString;
|
|
30
|
+
element_path: z.ZodString;
|
|
31
|
+
element_type: z.ZodString;
|
|
32
|
+
label: z.ZodOptional<z.ZodString>;
|
|
33
|
+
props: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
34
|
+
children_count: z.ZodNumber;
|
|
35
|
+
}, z.core.$strip>;
|
|
36
|
+
export interface ElementsHandlerDeps {
|
|
37
|
+
readonly client: RestClient;
|
|
38
|
+
/**
|
|
39
|
+
* Optional MCP elicitation capability. When present, destructive
|
|
40
|
+
* tools (`element_delete`) prompt the user for confirmation via the
|
|
41
|
+
* elicitation channel instead of demanding an explicit
|
|
42
|
+
* `confirm: true` round-trip. When absent, tools fall back to the
|
|
43
|
+
* preview-then-retry flow.
|
|
44
|
+
*/
|
|
45
|
+
readonly elicitation?: McpServerWithElicitation;
|
|
46
|
+
}
|
|
47
|
+
export declare function handleElementList({ client }: ElementsHandlerDeps, { template_id, fields }: {
|
|
48
|
+
template_id: string;
|
|
49
|
+
fields?: readonly string[];
|
|
50
|
+
}): Promise<ToolResult>;
|
|
51
|
+
export declare function handleElementGet({ client }: ElementsHandlerDeps, { template_id, element_path }: {
|
|
52
|
+
template_id: string;
|
|
53
|
+
element_path: string;
|
|
54
|
+
}): Promise<ToolResult>;
|
|
55
|
+
export { handleElementAdd, handleElementClone, handleElementDelete, handleElementMove, handleElementUpdateSettings, } from './handlers-write.js';
|
|
56
|
+
//# sourceMappingURL=handlers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../../src/tools/elements/handlers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAqB,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACrE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAYlE,OAAO,EAGH,KAAK,UAAU,EAClB,MAAM,oBAAoB,CAAC;AAI5B,eAAO,MAAM,0BAA0B;;;;;iBAKrC,CAAC;AAEH,eAAO,MAAM,yBAAyB;;;;;;;iBAOpC,CAAC;AAIH,MAAM,WAAW,mBAAmB;IAChC,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B;;;;;;OAMG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,wBAAwB,CAAC;CACnD;AAID,wBAAsB,iBAAiB,CACnC,EAAE,MAAM,EAAE,EAAE,mBAAmB,EAC/B,EAAE,WAAW,EAAE,MAAM,EAAE,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,GAC7E,OAAO,CAAC,UAAU,CAAC,CA8BrB;AAID,wBAAsB,gBAAgB,CAClC,EAAE,MAAM,EAAE,EAAE,mBAAmB,EAC/B,EAAE,WAAW,EAAE,YAAY,EAAE,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,GAC7E,OAAO,CAAC,UAAU,CAAC,CA8CrB;AAGD,OAAO,EACH,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,2BAA2B,GAC9B,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Element-tool read handlers + shared types/schemas.
|
|
3
|
+
*
|
|
4
|
+
* Split out of the original `src/tools/elements.ts` (Wave G.4.0). Write
|
|
5
|
+
* handlers (add/update/move/clone/delete) live in `./handlers-write.ts`
|
|
6
|
+
* to keep each file under the 200-LoC budget.
|
|
7
|
+
*
|
|
8
|
+
* Handler responsibilities:
|
|
9
|
+
* - call the REST endpoint via `deps.client`,
|
|
10
|
+
* - map REST data to the toolkit output builders (`tableResult`,
|
|
11
|
+
* `detailResult`),
|
|
12
|
+
* - wrap in `structuredResult` to carry the typed
|
|
13
|
+
* `structuredContent` payload,
|
|
14
|
+
* - on error, return `errorResult` with `context` + `hint`.
|
|
15
|
+
*
|
|
16
|
+
* @license MIT
|
|
17
|
+
*/
|
|
18
|
+
import { detailResult, tableResult } from '@getimo/mcp-toolkit';
|
|
19
|
+
import { z } from 'zod';
|
|
20
|
+
import { encodeElementPath } from '../../client.js';
|
|
21
|
+
import { ELEMENTS_COMPACT_COLUMNS, ELEMENTS_TABLE_COLUMNS, buildElementDetail, mapElementRow, } from '../format/elements-format.js';
|
|
22
|
+
import { DEFAULT_FIELDS_ELEMENT_LIST, projectFields, projectedFieldsEcho, } from '../sparse-fields.js';
|
|
23
|
+
import { errorResult, structuredResult, } from '../tool-builder.js';
|
|
24
|
+
// ─── outputSchemas (Wave G.2 §4) ─────────────────────────────────────
|
|
25
|
+
export const ELEMENT_LIST_OUTPUT_SCHEMA = z.object({
|
|
26
|
+
items: z.array(z.record(z.string(), z.unknown())),
|
|
27
|
+
total: z.number(),
|
|
28
|
+
template_id: z.string(),
|
|
29
|
+
projected_fields: z.array(z.string()).optional(),
|
|
30
|
+
});
|
|
31
|
+
export const ELEMENT_GET_OUTPUT_SCHEMA = z.object({
|
|
32
|
+
template_id: z.string(),
|
|
33
|
+
element_path: z.string(),
|
|
34
|
+
element_type: z.string(),
|
|
35
|
+
label: z.string().optional(),
|
|
36
|
+
props: z.record(z.string(), z.unknown()).optional(),
|
|
37
|
+
children_count: z.number(),
|
|
38
|
+
});
|
|
39
|
+
// ─── element_list ────────────────────────────────────────────────────
|
|
40
|
+
export async function handleElementList({ client }, { template_id, fields }) {
|
|
41
|
+
try {
|
|
42
|
+
const data = await client.get(`/pages/${encodeURIComponent(template_id)}/elements`);
|
|
43
|
+
const raw = Array.isArray(data.elements) ? data.elements : [];
|
|
44
|
+
const mapped = raw
|
|
45
|
+
.filter((x) => x !== null && typeof x === 'object')
|
|
46
|
+
.map(mapElementRow);
|
|
47
|
+
const items = projectFields(mapped, fields, DEFAULT_FIELDS_ELEMENT_LIST);
|
|
48
|
+
const echo = projectedFieldsEcho(fields, DEFAULT_FIELDS_ELEMENT_LIST);
|
|
49
|
+
const toolkitResult = tableResult(mapped, {
|
|
50
|
+
columns: [...ELEMENTS_TABLE_COLUMNS],
|
|
51
|
+
compactColumns: [...ELEMENTS_COMPACT_COLUMNS],
|
|
52
|
+
header: (count) => `${String(count)} elements in template "${template_id}"`,
|
|
53
|
+
footer: 'Use yootheme_builder_element_get <path> for full data.',
|
|
54
|
+
});
|
|
55
|
+
return structuredResult(toolkitResult, {
|
|
56
|
+
items,
|
|
57
|
+
total: items.length,
|
|
58
|
+
template_id,
|
|
59
|
+
...(echo !== undefined ? { projected_fields: [...echo] } : {}),
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
catch (e) {
|
|
63
|
+
return errorResult({
|
|
64
|
+
error: e,
|
|
65
|
+
context: { template_id },
|
|
66
|
+
hint: 'Verify the template_id via yootheme_builder_pages_list.',
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
// ─── element_get ─────────────────────────────────────────────────────
|
|
71
|
+
export async function handleElementGet({ client }, { template_id, element_path }) {
|
|
72
|
+
const encoded = encodeElementPath(element_path);
|
|
73
|
+
try {
|
|
74
|
+
const data = await client.get(`/pages/${encodeURIComponent(template_id)}/elements/${encoded}`);
|
|
75
|
+
const elementType = typeof data.element_type === 'string'
|
|
76
|
+
? data.element_type
|
|
77
|
+
: typeof data.type === 'string'
|
|
78
|
+
? data.type
|
|
79
|
+
: '';
|
|
80
|
+
const label = typeof data.label === 'string' ? data.label : undefined;
|
|
81
|
+
const propsRaw = data.props;
|
|
82
|
+
const props = propsRaw !== null && typeof propsRaw === 'object'
|
|
83
|
+
? propsRaw
|
|
84
|
+
: undefined;
|
|
85
|
+
const children = Array.isArray(data.children) ? data.children : [];
|
|
86
|
+
const toolkitResult = detailResult(buildElementDetail({
|
|
87
|
+
path: element_path,
|
|
88
|
+
element_type: elementType,
|
|
89
|
+
label,
|
|
90
|
+
props,
|
|
91
|
+
children: children,
|
|
92
|
+
}));
|
|
93
|
+
return structuredResult(toolkitResult, {
|
|
94
|
+
template_id,
|
|
95
|
+
element_path,
|
|
96
|
+
element_type: elementType,
|
|
97
|
+
...(label !== undefined ? { label } : {}),
|
|
98
|
+
...(props !== undefined ? { props } : {}),
|
|
99
|
+
children_count: children.length,
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
catch (e) {
|
|
103
|
+
return errorResult({
|
|
104
|
+
error: e,
|
|
105
|
+
context: { template_id, element_path },
|
|
106
|
+
hint: 'Paths are JSON-Pointer style ("/0/children/1"). Use ' +
|
|
107
|
+
'yootheme_builder_element_list to enumerate valid paths.',
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
// Re-export write handlers so callers can import from this barrel.
|
|
112
|
+
export { handleElementAdd, handleElementClone, handleElementDelete, handleElementMove, handleElementUpdateSettings, } from './handlers-write.js';
|
|
113
|
+
//# sourceMappingURL=handlers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handlers.js","sourceRoot":"","sources":["../../../src/tools/elements/handlers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAmB,MAAM,iBAAiB,CAAC;AAErE,OAAO,EACH,wBAAwB,EACxB,sBAAsB,EACtB,kBAAkB,EAClB,aAAa,GAChB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACH,2BAA2B,EAC3B,aAAa,EACb,mBAAmB,GACtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACH,WAAW,EACX,gBAAgB,GAEnB,MAAM,oBAAoB,CAAC;AAE5B,wEAAwE;AAExE,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;IACjD,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,gBAAgB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;CACnD,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,YAAY,EAAE,CAAC,CAAC,MA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IAAI,OAAO,QAAQ,KAAK,QAAQ;YAC7C,CAAC,CAAE,QAAoC;YACvC,CAAC,CAAC,SAAS,CAAC;QACpB,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;QAEnE,MAAM,aAAa,GAAG,YAAY,CAC9B,kBAAkB,CAAC;YACf,IAAI,EAAE,YAAY;YAClB,YAAY,EAAE,WAAW;YACzB,KAAK;YACL,KAAK;YACL,QAAQ,EAAE,QAAqC;SAClD,CAAC,CACL,CAAC;QACF,OAAO,gBAAgB,CAAC,aAAa,EAAE;YACnC,WAAW;YACX,YAAY;YACZ,YAAY,EAAE,WAAW;YACzB,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACzC,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACzC,cAAc,EAAE,QAAQ,CAAC,MAAM;SAClC,CAAC,CAAC;IACP,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACT,OAAO,WAAW,CAAC;YACf,KAAK,EAAE,CAAC;YACR,OAAO,EAAE,EAAE,WAAW,EAAE,YAAY,EAAE;YACtC,IAAI,EACA,sDAAsD;gBACtD,yDAAyD;SAChE,CAAC,CAAC;IACP,CAAC;AACL,CAAC;AAED,mEAAmE;AACnE,OAAO,EACH,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,2BAA2B,GAC9B,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Element-tool barrel — public entry-point for the 7 element tools.
|
|
3
|
+
*
|
|
4
|
+
* yootheme_builder_element_list
|
|
5
|
+
* → list all elements in a template (flat, with paths)
|
|
6
|
+
* yootheme_builder_element_get
|
|
7
|
+
* → fetch one element by JSON-Pointer
|
|
8
|
+
* yootheme_builder_element_add
|
|
9
|
+
* → POST new element
|
|
10
|
+
* yootheme_builder_element_update_settings
|
|
11
|
+
* → PUT props on an existing element
|
|
12
|
+
* yootheme_builder_element_move
|
|
13
|
+
* → relocate within tree
|
|
14
|
+
* yootheme_builder_element_clone
|
|
15
|
+
* → duplicate as sibling
|
|
16
|
+
* yootheme_builder_element_delete (destructive — elicit/confirm)
|
|
17
|
+
*
|
|
18
|
+
* Wave G.4.0 — file split from the monolithic `src/tools/elements.ts`
|
|
19
|
+
* (382 LoC) into `index.ts` (this file, re-exports), `builders.ts`
|
|
20
|
+
* (defineTool factory list, ≤200 LoC), and `handlers.ts` (handler
|
|
21
|
+
* bodies, ≤300 LoC). Tool surface is unchanged — see
|
|
22
|
+
* `tests/tools/elements-split.test.ts` for the snapshot proof.
|
|
23
|
+
*
|
|
24
|
+
* @license MIT
|
|
25
|
+
*/
|
|
26
|
+
export { buildElementsTools } from './builders.js';
|
|
27
|
+
export type { ElementsHandlerDeps } from './handlers.js';
|
|
28
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/elements/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,YAAY,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Element-tool barrel — public entry-point for the 7 element tools.
|
|
3
|
+
*
|
|
4
|
+
* yootheme_builder_element_list
|
|
5
|
+
* → list all elements in a template (flat, with paths)
|
|
6
|
+
* yootheme_builder_element_get
|
|
7
|
+
* → fetch one element by JSON-Pointer
|
|
8
|
+
* yootheme_builder_element_add
|
|
9
|
+
* → POST new element
|
|
10
|
+
* yootheme_builder_element_update_settings
|
|
11
|
+
* → PUT props on an existing element
|
|
12
|
+
* yootheme_builder_element_move
|
|
13
|
+
* → relocate within tree
|
|
14
|
+
* yootheme_builder_element_clone
|
|
15
|
+
* → duplicate as sibling
|
|
16
|
+
* yootheme_builder_element_delete (destructive — elicit/confirm)
|
|
17
|
+
*
|
|
18
|
+
* Wave G.4.0 — file split from the monolithic `src/tools/elements.ts`
|
|
19
|
+
* (382 LoC) into `index.ts` (this file, re-exports), `builders.ts`
|
|
20
|
+
* (defineTool factory list, ≤200 LoC), and `handlers.ts` (handler
|
|
21
|
+
* bodies, ≤300 LoC). Tool surface is unchanged — see
|
|
22
|
+
* `tests/tools/elements-split.test.ts` for the snapshot proof.
|
|
23
|
+
*
|
|
24
|
+
* @license MIT
|
|
25
|
+
*/
|
|
26
|
+
export { buildElementsTools } from './builders.js';
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/elements/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Backwards-compatible re-export shim.
|
|
3
|
+
*
|
|
4
|
+
* Wave G.4.0 split the original 382-LoC `elements.ts` into
|
|
5
|
+
* `./elements/{index, handlers, builders}.ts`. This shim keeps the
|
|
6
|
+
* legacy import path (`from '../tools/elements.js'`) working for
|
|
7
|
+
* downstream callers and tests. New code should import from
|
|
8
|
+
* `./elements/index.js` directly.
|
|
9
|
+
*
|
|
10
|
+
* @license MIT
|
|
11
|
+
*/
|
|
12
|
+
export { buildElementsTools } from './elements/index.js';
|
|
13
|
+
//# sourceMappingURL=elements.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"elements.d.ts","sourceRoot":"","sources":["../../src/tools/elements.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Backwards-compatible re-export shim.
|
|
3
|
+
*
|
|
4
|
+
* Wave G.4.0 split the original 382-LoC `elements.ts` into
|
|
5
|
+
* `./elements/{index, handlers, builders}.ts`. This shim keeps the
|
|
6
|
+
* legacy import path (`from '../tools/elements.js'`) working for
|
|
7
|
+
* downstream callers and tests. New code should import from
|
|
8
|
+
* `./elements/index.js` directly.
|
|
9
|
+
*
|
|
10
|
+
* @license MIT
|
|
11
|
+
*/
|
|
12
|
+
export { buildElementsTools } from './elements/index.js';
|
|
13
|
+
//# sourceMappingURL=elements.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"elements.js","sourceRoot":"","sources":["../../src/tools/elements.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Targeted-elicitation support (Wave G.4 — Design §3.4 / §4.18).
|
|
3
|
+
*
|
|
4
|
+
* Three tool sites use elicitation:
|
|
5
|
+
* - element_delete (destructive confirm)
|
|
6
|
+
* - element_unbind_source (destructive confirm)
|
|
7
|
+
* - element_bind_source (ambiguity resolution: ≥2 sources with the
|
|
8
|
+
* same `source_name` → ask the user which one)
|
|
9
|
+
*
|
|
10
|
+
* Architecture mirrors `~/Projekte/wootsup/packages/apimapper-mcp/src/
|
|
11
|
+
* modules/apimapper/elicitation.ts` (the reference Goldstandard impl):
|
|
12
|
+
*
|
|
13
|
+
* 1. `toElicitationCapability(server)` — typed adapter that bridges the
|
|
14
|
+
* SDK's stricter discriminated `ElicitRequestFormParams` to the
|
|
15
|
+
* toolkit's looser `ElicitInputParams`. ONE documented cast, justified
|
|
16
|
+
* by the toolkit only ever emitting form-mode requests.
|
|
17
|
+
* 2. `ElicitationCandidate` + `renderCandidateList` — a candidate is
|
|
18
|
+
* `{ id, label }`; the list renders as a readable bullet block for the
|
|
19
|
+
* mandatory non-elicitation fallback error.
|
|
20
|
+
* 3. `ambiguityFallbackError` — the structured `errorResult` returned
|
|
21
|
+
* when elicitation is unavailable (unsupported client) or declined.
|
|
22
|
+
* Lists every candidate so the LLM (or operator) has an actionable
|
|
23
|
+
* recovery path: "retry with explicit param X set to one of …".
|
|
24
|
+
*
|
|
25
|
+
* MANDATORY non-elicitation fallback: `elicitChoice` returns `null` on a
|
|
26
|
+
* client without elicitation support, on decline, and on cancel. Every
|
|
27
|
+
* call site MUST then return a structured `errorResult` listing the
|
|
28
|
+
* candidates with a recovery hint — never hang, never guess, never
|
|
29
|
+
* silently pick.
|
|
30
|
+
*
|
|
31
|
+
* @license MIT
|
|
32
|
+
*/
|
|
33
|
+
import type { McpServerWithElicitation } from '@getimo/mcp-toolkit';
|
|
34
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
35
|
+
import { type ToolResult } from './tool-builder.js';
|
|
36
|
+
export type { McpServerWithElicitation };
|
|
37
|
+
/**
|
|
38
|
+
* Build the `McpServerWithElicitation` capability object the toolkit's
|
|
39
|
+
* `elicitChoice` / `elicitConfirmation` consume, from the real `McpServer`.
|
|
40
|
+
*
|
|
41
|
+
* Why an adapter and not the bare `McpServer`:
|
|
42
|
+
* The toolkit's `McpServerWithElicitation.server.elicitInput` is typed
|
|
43
|
+
* with the loose `ElicitInputParams` (`mode: "form" | "url"`,
|
|
44
|
+
* `requestedSchema?: Record<string, unknown>`). The SDK's
|
|
45
|
+
* `Server.elicitInput` is the stricter discriminated
|
|
46
|
+
* `ElicitRequestFormParams | ElicitRequestURLParams` with a fully-typed
|
|
47
|
+
* `requestedSchema`. A real `McpServer` is therefore NOT structurally
|
|
48
|
+
* assignable to `McpServerWithElicitation` — the parameter types are
|
|
49
|
+
* contravariantly incompatible.
|
|
50
|
+
*
|
|
51
|
+
* The toolkit's `elicitChoice` / `elicitConfirmation` ALWAYS call with
|
|
52
|
+
* `mode: "form"` and a `requestedSchema` whose properties are plain
|
|
53
|
+
* `{ type: "string", enum: [...] }` / `{ type: "boolean" }` shapes —
|
|
54
|
+
* i.e. always a valid `ElicitRequestFormParams` at runtime. This adapter
|
|
55
|
+
* is the single, documented interop boundary that re-narrows the loose
|
|
56
|
+
* toolkit params to the SDK's form-params type.
|
|
57
|
+
*/
|
|
58
|
+
export declare function toElicitationCapability(realServer: McpServer): McpServerWithElicitation;
|
|
59
|
+
/**
|
|
60
|
+
* A disambiguation candidate. `id` is the value a tool needs (source ID,
|
|
61
|
+
* credential ID, …); `label` is a human-readable name shown in the
|
|
62
|
+
* elicitation prompt and the fallback error list.
|
|
63
|
+
*/
|
|
64
|
+
export interface ElicitationCandidate {
|
|
65
|
+
readonly id: string;
|
|
66
|
+
readonly label: string;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Render a candidate list as a readable bullet block for the structured
|
|
70
|
+
* fallback error — so a client without elicitation support still gets a
|
|
71
|
+
* fully actionable recovery path.
|
|
72
|
+
*/
|
|
73
|
+
export declare function renderCandidateList(candidates: readonly ElicitationCandidate[]): string;
|
|
74
|
+
/**
|
|
75
|
+
* Build the structured `errorResult` returned when elicitation is
|
|
76
|
+
* unavailable (unsupported client) or the user declined / cancelled. The
|
|
77
|
+
* error names every candidate and tells the caller exactly which
|
|
78
|
+
* parameter to supply on retry.
|
|
79
|
+
*/
|
|
80
|
+
export declare function ambiguityFallbackError(opts: {
|
|
81
|
+
code: string;
|
|
82
|
+
paramName: string;
|
|
83
|
+
what: string;
|
|
84
|
+
candidates: readonly ElicitationCandidate[];
|
|
85
|
+
context: Record<string, unknown>;
|
|
86
|
+
}): ToolResult;
|
|
87
|
+
//# sourceMappingURL=elicitation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"elicitation.d.ts","sourceRoot":"","sources":["../../src/tools/elicitation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,KAAK,EAER,wBAAwB,EAC3B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGzE,OAAO,EAAe,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEjE,YAAY,EAAE,wBAAwB,EAAE,CAAC;AAEzC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,uBAAuB,CACnC,UAAU,EAAE,SAAS,GACtB,wBAAwB,CAe1B;AAED;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACjC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CAC1B;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,SAAS,oBAAoB,EAAE,GAAG,MAAM,CAEvF;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,SAAS,oBAAoB,EAAE,CAAC;IAC5C,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC,GAAG,UAAU,CAeb"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Targeted-elicitation support (Wave G.4 — Design §3.4 / §4.18).
|
|
3
|
+
*
|
|
4
|
+
* Three tool sites use elicitation:
|
|
5
|
+
* - element_delete (destructive confirm)
|
|
6
|
+
* - element_unbind_source (destructive confirm)
|
|
7
|
+
* - element_bind_source (ambiguity resolution: ≥2 sources with the
|
|
8
|
+
* same `source_name` → ask the user which one)
|
|
9
|
+
*
|
|
10
|
+
* Architecture mirrors `~/Projekte/wootsup/packages/apimapper-mcp/src/
|
|
11
|
+
* modules/apimapper/elicitation.ts` (the reference Goldstandard impl):
|
|
12
|
+
*
|
|
13
|
+
* 1. `toElicitationCapability(server)` — typed adapter that bridges the
|
|
14
|
+
* SDK's stricter discriminated `ElicitRequestFormParams` to the
|
|
15
|
+
* toolkit's looser `ElicitInputParams`. ONE documented cast, justified
|
|
16
|
+
* by the toolkit only ever emitting form-mode requests.
|
|
17
|
+
* 2. `ElicitationCandidate` + `renderCandidateList` — a candidate is
|
|
18
|
+
* `{ id, label }`; the list renders as a readable bullet block for the
|
|
19
|
+
* mandatory non-elicitation fallback error.
|
|
20
|
+
* 3. `ambiguityFallbackError` — the structured `errorResult` returned
|
|
21
|
+
* when elicitation is unavailable (unsupported client) or declined.
|
|
22
|
+
* Lists every candidate so the LLM (or operator) has an actionable
|
|
23
|
+
* recovery path: "retry with explicit param X set to one of …".
|
|
24
|
+
*
|
|
25
|
+
* MANDATORY non-elicitation fallback: `elicitChoice` returns `null` on a
|
|
26
|
+
* client without elicitation support, on decline, and on cancel. Every
|
|
27
|
+
* call site MUST then return a structured `errorResult` listing the
|
|
28
|
+
* candidates with a recovery hint — never hang, never guess, never
|
|
29
|
+
* silently pick.
|
|
30
|
+
*
|
|
31
|
+
* @license MIT
|
|
32
|
+
*/
|
|
33
|
+
import { errorResult } from './tool-builder.js';
|
|
34
|
+
/**
|
|
35
|
+
* Build the `McpServerWithElicitation` capability object the toolkit's
|
|
36
|
+
* `elicitChoice` / `elicitConfirmation` consume, from the real `McpServer`.
|
|
37
|
+
*
|
|
38
|
+
* Why an adapter and not the bare `McpServer`:
|
|
39
|
+
* The toolkit's `McpServerWithElicitation.server.elicitInput` is typed
|
|
40
|
+
* with the loose `ElicitInputParams` (`mode: "form" | "url"`,
|
|
41
|
+
* `requestedSchema?: Record<string, unknown>`). The SDK's
|
|
42
|
+
* `Server.elicitInput` is the stricter discriminated
|
|
43
|
+
* `ElicitRequestFormParams | ElicitRequestURLParams` with a fully-typed
|
|
44
|
+
* `requestedSchema`. A real `McpServer` is therefore NOT structurally
|
|
45
|
+
* assignable to `McpServerWithElicitation` — the parameter types are
|
|
46
|
+
* contravariantly incompatible.
|
|
47
|
+
*
|
|
48
|
+
* The toolkit's `elicitChoice` / `elicitConfirmation` ALWAYS call with
|
|
49
|
+
* `mode: "form"` and a `requestedSchema` whose properties are plain
|
|
50
|
+
* `{ type: "string", enum: [...] }` / `{ type: "boolean" }` shapes —
|
|
51
|
+
* i.e. always a valid `ElicitRequestFormParams` at runtime. This adapter
|
|
52
|
+
* is the single, documented interop boundary that re-narrows the loose
|
|
53
|
+
* toolkit params to the SDK's form-params type.
|
|
54
|
+
*/
|
|
55
|
+
export function toElicitationCapability(realServer) {
|
|
56
|
+
return {
|
|
57
|
+
server: {
|
|
58
|
+
elicitInput: (params) =>
|
|
59
|
+
// Cast: the toolkit only ever produces form-mode elicitation
|
|
60
|
+
// requests (verified: elicitChoice + elicitConfirmation both pass
|
|
61
|
+
// `mode: "form"` with a string/boolean `requestedSchema`). The
|
|
62
|
+
// loose `ElicitInputParams` is asserted to the SDK's
|
|
63
|
+
// `ElicitRequestFormParams` so the SDK's overloaded
|
|
64
|
+
// `elicitInput` accepts it. The runtime payload is exactly a
|
|
65
|
+
// valid form request — only the static type is widened on the
|
|
66
|
+
// toolkit side.
|
|
67
|
+
realServer.server.elicitInput(params),
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Render a candidate list as a readable bullet block for the structured
|
|
73
|
+
* fallback error — so a client without elicitation support still gets a
|
|
74
|
+
* fully actionable recovery path.
|
|
75
|
+
*/
|
|
76
|
+
export function renderCandidateList(candidates) {
|
|
77
|
+
return candidates.map((c) => ` • ${c.id} — ${c.label}`).join('\n');
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Build the structured `errorResult` returned when elicitation is
|
|
81
|
+
* unavailable (unsupported client) or the user declined / cancelled. The
|
|
82
|
+
* error names every candidate and tells the caller exactly which
|
|
83
|
+
* parameter to supply on retry.
|
|
84
|
+
*/
|
|
85
|
+
export function ambiguityFallbackError(opts) {
|
|
86
|
+
const list = renderCandidateList(opts.candidates);
|
|
87
|
+
return errorResult({
|
|
88
|
+
// We piggy-back on the local errorResult shape: `error` is the
|
|
89
|
+
// human-readable message, `context` echoes inputs + candidate ids,
|
|
90
|
+
// `hint` is the recovery instruction with the full candidate list.
|
|
91
|
+
error: new Error(`Multiple ${opts.what} match — cannot pick automatically.`),
|
|
92
|
+
context: {
|
|
93
|
+
...opts.context,
|
|
94
|
+
code: opts.code,
|
|
95
|
+
candidates: opts.candidates.map((c) => ({ id: c.id, label: c.label })),
|
|
96
|
+
},
|
|
97
|
+
hint: `Retry with an explicit \`${opts.paramName}\` set to one of:\n${list}`,
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=elicitation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"elicitation.js","sourceRoot":"","sources":["../../src/tools/elicitation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AASH,OAAO,EAAE,WAAW,EAAmB,MAAM,mBAAmB,CAAC;AAIjE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,uBAAuB,CACnC,UAAqB;IAErB,OAAO;QACH,MAAM,EAAE;YACJ,WAAW,EAAE,CAAC,MAAyB,EAAE,EAAE;YACvC,6DAA6D;YAC7D,kEAAkE;YAClE,+DAA+D;YAC/D,qDAAqD;YACrD,oDAAoD;YACpD,6DAA6D;YAC7D,8DAA8D;YAC9D,gBAAgB;YAChB,UAAU,CAAC,MAAM,CAAC,WAAW,CAAC,MAAiC,CAAC;SACvE;KACJ,CAAC;AACN,CAAC;AAYD;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,UAA2C;IAC3E,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACxE,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CAAC,IAMtC;IACG,MAAM,IAAI,GAAG,mBAAmB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAClD,OAAO,WAAW,CAAC;QACf,+DAA+D;QAC/D,mEAAmE;QACnE,mEAAmE;QACnE,KAAK,EAAE,IAAI,KAAK,CAAC,YAAY,IAAI,CAAC,IAAI,qCAAqC,CAAC;QAC5E,OAAO,EAAE;YACL,GAAG,IAAI,CAAC,OAAO;YACf,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;SACzE;QACD,IAAI,EACA,4BAA4B,IAAI,CAAC,SAAS,sBAAsB,IAAI,EAAE;KAC7E,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Elements format-sidecar — pure transforms for `element_list` (table) and
|
|
3
|
+
* `element_get` (detail). Wave G.2.5 (Design §3.2 rows 9 / 10).
|
|
4
|
+
*
|
|
5
|
+
* @license MIT
|
|
6
|
+
*/
|
|
7
|
+
import type { DetailGroup, TableColumn } from '@getimo/mcp-toolkit';
|
|
8
|
+
export declare const ELEMENTS_TABLE_COLUMNS: readonly TableColumn[];
|
|
9
|
+
/** Compact columns kick in at 21+ rows — keep path + type only. */
|
|
10
|
+
export declare const ELEMENTS_COMPACT_COLUMNS: readonly TableColumn[];
|
|
11
|
+
/**
|
|
12
|
+
* Maps an `/elements` row to the table shape.
|
|
13
|
+
*
|
|
14
|
+
* - `label` falls back to `title` (REST surface varies — newer builds emit
|
|
15
|
+
* `label`, older emit `title` as the human-readable name).
|
|
16
|
+
* - `has_binding` honours an explicit boolean from the REST plugin, else
|
|
17
|
+
* derives from `props.source` presence.
|
|
18
|
+
*/
|
|
19
|
+
export declare function mapElementRow(input: Record<string, unknown>): Record<string, unknown>;
|
|
20
|
+
interface ElementChildLike {
|
|
21
|
+
type?: unknown;
|
|
22
|
+
}
|
|
23
|
+
export declare function buildElementDetail(payload: {
|
|
24
|
+
path: string;
|
|
25
|
+
element_type: string;
|
|
26
|
+
props?: unknown;
|
|
27
|
+
children?: ElementChildLike[];
|
|
28
|
+
label?: string;
|
|
29
|
+
}): {
|
|
30
|
+
groups: DetailGroup[];
|
|
31
|
+
title?: string;
|
|
32
|
+
};
|
|
33
|
+
export {};
|
|
34
|
+
//# sourceMappingURL=elements-format.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"elements-format.d.ts","sourceRoot":"","sources":["../../../src/tools/format/elements-format.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAIpE,eAAO,MAAM,sBAAsB,EAAE,SAAS,WAAW,EAKxD,CAAC;AAEF,mEAAmE;AACnE,eAAO,MAAM,wBAAwB,EAAE,SAAS,WAAW,EAG1D,CAAC;AAcF;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAgBrF;AAID,UAAU,gBAAgB;IACtB,IAAI,CAAC,EAAE,OAAO,CAAC;CAClB;AAoBD,wBAAgB,kBAAkB,CAAC,OAAO,EAAE;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB,GAAG;IAAE,MAAM,EAAE,WAAW,EAAE,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CA4C5C"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Elements format-sidecar — pure transforms for `element_list` (table) and
|
|
3
|
+
* `element_get` (detail). Wave G.2.5 (Design §3.2 rows 9 / 10).
|
|
4
|
+
*
|
|
5
|
+
* @license MIT
|
|
6
|
+
*/
|
|
7
|
+
// ─── Element-list columns (Design §3.2 row 9) ────────────────────────
|
|
8
|
+
export const ELEMENTS_TABLE_COLUMNS = [
|
|
9
|
+
{ key: 'path', label: 'PATH', width: 32, llmOnly: true },
|
|
10
|
+
{ key: 'element_type', label: 'TYPE', width: 16 },
|
|
11
|
+
{ key: 'label', label: 'LABEL', width: 28 },
|
|
12
|
+
{ key: 'has_binding', label: 'BIND', width: 8 },
|
|
13
|
+
];
|
|
14
|
+
/** Compact columns kick in at 21+ rows — keep path + type only. */
|
|
15
|
+
export const ELEMENTS_COMPACT_COLUMNS = [
|
|
16
|
+
{ key: 'path', label: 'PATH', width: 32, llmOnly: true },
|
|
17
|
+
{ key: 'element_type', label: 'TYPE', width: 16 },
|
|
18
|
+
];
|
|
19
|
+
// ─── Row mapper ──────────────────────────────────────────────────────
|
|
20
|
+
function asString(v) {
|
|
21
|
+
return typeof v === 'string' ? v : '';
|
|
22
|
+
}
|
|
23
|
+
function hasSourceBinding(props) {
|
|
24
|
+
if (props === null || typeof props !== 'object')
|
|
25
|
+
return false;
|
|
26
|
+
const obj = props;
|
|
27
|
+
return typeof obj.source === 'string' && obj.source.length > 0;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Maps an `/elements` row to the table shape.
|
|
31
|
+
*
|
|
32
|
+
* - `label` falls back to `title` (REST surface varies — newer builds emit
|
|
33
|
+
* `label`, older emit `title` as the human-readable name).
|
|
34
|
+
* - `has_binding` honours an explicit boolean from the REST plugin, else
|
|
35
|
+
* derives from `props.source` presence.
|
|
36
|
+
*/
|
|
37
|
+
export function mapElementRow(input) {
|
|
38
|
+
const label = asString(input.label) !== ''
|
|
39
|
+
? asString(input.label)
|
|
40
|
+
: asString(input.title);
|
|
41
|
+
const explicitBinding = typeof input.has_binding === 'boolean' ? input.has_binding : undefined;
|
|
42
|
+
return {
|
|
43
|
+
path: asString(input.path),
|
|
44
|
+
element_type: asString(input.element_type),
|
|
45
|
+
label,
|
|
46
|
+
has_binding: explicitBinding ?? hasSourceBinding(input.props),
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function summarizeProps(props) {
|
|
50
|
+
if (props === null || typeof props !== 'object')
|
|
51
|
+
return '—';
|
|
52
|
+
const keys = Object.keys(props);
|
|
53
|
+
if (keys.length === 0)
|
|
54
|
+
return '—';
|
|
55
|
+
if (keys.length <= 6)
|
|
56
|
+
return keys.join(', ');
|
|
57
|
+
return `${keys.slice(0, 6).join(', ')}, …(+${String(keys.length - 6)} more)`;
|
|
58
|
+
}
|
|
59
|
+
function listChildTypes(children) {
|
|
60
|
+
if (children.length === 0)
|
|
61
|
+
return '—';
|
|
62
|
+
const seen = new Map();
|
|
63
|
+
for (const c of children) {
|
|
64
|
+
const t = typeof c.type === 'string' ? c.type : '?';
|
|
65
|
+
seen.set(t, (seen.get(t) ?? 0) + 1);
|
|
66
|
+
}
|
|
67
|
+
return [...seen.entries()].map(([t, n]) => (n > 1 ? `${t}×${String(n)}` : t)).join(', ');
|
|
68
|
+
}
|
|
69
|
+
export function buildElementDetail(payload) {
|
|
70
|
+
const children = Array.isArray(payload.children) ? payload.children : [];
|
|
71
|
+
return {
|
|
72
|
+
title: `Element ${payload.path}`,
|
|
73
|
+
groups: [
|
|
74
|
+
{
|
|
75
|
+
label: 'Identity',
|
|
76
|
+
entries: [
|
|
77
|
+
{ key: 'path', label: 'Path', value: payload.path, format: 'code', copyable: true },
|
|
78
|
+
{ key: 'element_type', label: 'Type', value: payload.element_type, format: 'badge' },
|
|
79
|
+
...(typeof payload.label === 'string' && payload.label.length > 0
|
|
80
|
+
? [{ key: 'label', label: 'Label', value: payload.label }]
|
|
81
|
+
: []),
|
|
82
|
+
],
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
label: 'Props (summary)',
|
|
86
|
+
entries: [
|
|
87
|
+
{ key: 'keys', label: 'Keys', value: summarizeProps(payload.props) },
|
|
88
|
+
],
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
label: 'Children',
|
|
92
|
+
entries: [
|
|
93
|
+
{ key: 'count', label: 'Count', value: children.length, format: 'text' },
|
|
94
|
+
{ key: 'types', label: 'Types', value: listChildTypes(children) },
|
|
95
|
+
],
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
label: 'Next steps',
|
|
99
|
+
entries: [
|
|
100
|
+
{
|
|
101
|
+
key: 'next',
|
|
102
|
+
label: 'Suggestions',
|
|
103
|
+
value: 'Use yootheme_builder_element_update_settings to change props, ' +
|
|
104
|
+
'yootheme_builder_element_clone to duplicate, or ' +
|
|
105
|
+
'yootheme_builder_element_delete to remove (requires confirm).',
|
|
106
|
+
},
|
|
107
|
+
],
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=elements-format.js.map
|