@adobe/exc-app 1.5.10 → 1.5.12-beta

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/webmcp.js ADDED
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ /*************************************************************************
3
+ * Copyright 2026 Adobe
4
+ * All Rights Reserved.
5
+ *
6
+ * NOTICE: Adobe permits you to use, modify, and distribute this file in
7
+ * accordance with the terms of the Adobe license agreement accompanying
8
+ * it. If you have received this file from a source other than Adobe,
9
+ * then your use, modification, or distribution of it requires the prior
10
+ * written permission of Adobe.
11
+ **************************************************************************/
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.TOOLS_CHANGE_EVENT = void 0;
14
+ /**
15
+ * Solution-facing API for WebMCP tool registration.
16
+ *
17
+ * Solutions import this module to register browser-side tools that AO2
18
+ * can invoke. The tool handler functions execute locally in the APP iframe;
19
+ * only the serializable definition crosses postMessage to Core.
20
+ *
21
+ * ***Import:***
22
+ *
23
+ * ```typescript
24
+ * import webmcp from '@adobe/exc-app/webmcp';
25
+ * ```
26
+ *
27
+ * ***Default export:***
28
+ *
29
+ * [webmcpApi](../interfaces/webmcp.webmcpapi.md#interface-webmcpapi)
30
+ *
31
+ * ***Usage:***
32
+ *
33
+ * ```typescript
34
+ * // Register a custom tool
35
+ * webmcp.registerTool({
36
+ * name: 'getSelectedAssets',
37
+ * description: 'Returns the currently selected assets in the DAM',
38
+ * inputSchema: {
39
+ * type: 'object',
40
+ * properties: {
41
+ * includeMetadata: {
42
+ * type: 'boolean',
43
+ * description: 'Whether to include full metadata'
44
+ * }
45
+ * }
46
+ * },
47
+ * execute: async (parameters) => {
48
+ * const assets = await myApp.getSelectedAssets(parameters.includeMetadata);
49
+ * return { assets };
50
+ * }
51
+ * });
52
+ *
53
+ * // Unregister a tool
54
+ * webmcp.unregisterTool('getSelectedAssets');
55
+ * ```
56
+ * @packageDocumentation
57
+ * @module webmcp
58
+ */
59
+ const Global_1 = require("./src/Global");
60
+ exports.TOOLS_CHANGE_EVENT = 'change:tools';
61
+ const webmcp = {
62
+ executeTool: (name, parameters) => {
63
+ return (0, Global_1.getImpl)('webmcp')().executeTool(name, parameters);
64
+ },
65
+ getTools: () => {
66
+ return (0, Global_1.getImpl)('webmcp')().getTools();
67
+ },
68
+ off: (event, handler) => {
69
+ return (0, Global_1.getImpl)('webmcp')().off(event, handler);
70
+ },
71
+ on: (event, handler) => {
72
+ return (0, Global_1.getImpl)('webmcp')().on(event, handler);
73
+ },
74
+ registerTool: (definition) => {
75
+ return (0, Global_1.getImpl)('webmcp')().registerTool(definition);
76
+ },
77
+ unregisterTool: (name, component) => {
78
+ return (0, Global_1.getImpl)('webmcp')().unregisterTool(name, component);
79
+ }
80
+ };
81
+ exports.default = webmcp;
82
+ //# sourceMappingURL=webmcp.js.map
package/webmcp.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webmcp.js","sourceRoot":"","sources":["webmcp.ts"],"names":[],"mappings":";AAAA;;;;;;;;;4EAS4E;;;AAE5E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,yCAAqC;AAmBxB,QAAA,kBAAkB,GAAG,cAAc,CAAC;AAgKjD,MAAM,MAAM,GAAG;IACb,WAAW,EAAE,CAAC,IAAY,EAAE,UAAgC,EAAE,EAAE;QAC9D,OAAO,IAAA,gBAAO,EAAC,QAAQ,CAAC,EAAE,CAAC,WAAW,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IAC3D,CAAC;IACD,QAAQ,EAAE,GAAG,EAAE;QACb,OAAO,IAAA,gBAAO,EAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAA2C,CAAC;IACjF,CAAC;IACD,GAAG,EAAE,CAAC,KAAgC,EAAE,OAA4B,EAAE,EAAE;QACtE,OAAO,IAAA,gBAAO,EAAC,QAAQ,CAAC,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,CA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