@mcp-native/a2ui 0.0.3 → 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.
- package/README.md +49 -13
- package/dist/index.d.ts +26 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +160 -34
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
[](https://www.npmjs.com/package/@mcp-native/a2ui)
|
|
9
9
|
[](https://github.com/pablospaniard/mcp-native/blob/main/LICENSE)
|
|
10
10
|
|
|
11
|
-
[GitHub](https://github.com/pablospaniard/mcp-native) · [Architecture](https://github.com/pablospaniard/mcp-native/blob/main/docs/RFC-0001-architecture.md) · [Security](https://github.com/pablospaniard/mcp-native/blob/main/SECURITY.md)
|
|
11
|
+
[GitHub](https://github.com/pablospaniard/mcp-native) · [Architecture](https://github.com/pablospaniard/mcp-native/blob/main/docs/RFC-0001-architecture.md) · [Standards status](https://github.com/pablospaniard/mcp-native/blob/main/docs/standards-compatibility.md) · [Security](https://github.com/pablospaniard/mcp-native/blob/main/SECURITY.md)
|
|
12
12
|
|
|
13
13
|
</div>
|
|
14
14
|
|
|
15
|
-
> **Experimental:** this package implements MCP Native's deliberately small `0.1` proof-of-concept surface.
|
|
15
|
+
> **Experimental:** this package implements MCP Native's deliberately small internal `0.1` proof-of-concept surface. `0.1` is not an A2UI protocol version, and this package does not currently claim A2UI v1.0 compatibility.
|
|
16
16
|
|
|
17
|
-
`@mcp-native/a2ui` parses untrusted JSON or JavaScript values into a validated, typed surface before a host renders anything. Unknown versions, node types, action types, and invalid JSON values fail
|
|
17
|
+
`@mcp-native/a2ui` resolves explicitly typed resource links and parses untrusted JSON or JavaScript values into a validated, typed surface before a host renders anything. Unknown or ambiguous resources fail with `A2uiResourceError`; unknown versions, node types, action types, non-plain objects, oversized trees, and invalid JSON values fail with `A2uiParseError`. Surfaces are capped at `A2UI_MAX_DEPTH` (32) and `A2UI_MAX_NODES` (256).
|
|
18
18
|
|
|
19
19
|
## Install
|
|
20
20
|
|
|
@@ -65,6 +65,34 @@ const surface = parseA2uiSurface(
|
|
|
65
65
|
);
|
|
66
66
|
```
|
|
67
67
|
|
|
68
|
+
## Resolve a tool-result resource
|
|
69
|
+
|
|
70
|
+
An MCP tool may return a `resource_link` for a declarative surface. Pass the connected runtime or any `A2uiResourceReader` to the resolver:
|
|
71
|
+
|
|
72
|
+
```ts
|
|
73
|
+
import { resolveA2uiResourceFromToolResult } from "@mcp-native/a2ui";
|
|
74
|
+
|
|
75
|
+
const toolResult = await runtime.callTool("open_profile");
|
|
76
|
+
const resolved = await resolveA2uiResourceFromToolResult(runtime, toolResult);
|
|
77
|
+
|
|
78
|
+
console.log(resolved.uri);
|
|
79
|
+
console.log(resolved.surface.root);
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Resolution succeeds only when:
|
|
83
|
+
|
|
84
|
+
1. the tool result is not marked as an error;
|
|
85
|
+
2. it contains exactly one `resource_link` with MIME type `application/a2ui+json`;
|
|
86
|
+
3. `resources/read` returns exactly one item with the same URI and MIME type;
|
|
87
|
+
4. that item contains text, not a blob;
|
|
88
|
+
5. the text passes `parseA2uiSurface`.
|
|
89
|
+
|
|
90
|
+
Other tool content and non-A2UI resource links may coexist with the surface link. MCP Native never guesses a MIME type or chooses between multiple matching surfaces.
|
|
91
|
+
|
|
92
|
+
The prototype's `application/a2ui+json` resource convention comes from earlier A2UI-over-MCP work. The [A2UI v1.0 Candidate protocol](https://github.com/a2ui-project/a2ui/blob/7541f953050cd58b80f0bf5d85fe2d63192af305/specification/v1_0/docs/a2ui_protocol.md) is transport-agnostic and uses a stream of `v1.0` envelopes. Recognizing this media type does not establish v1.0 conformance.
|
|
93
|
+
|
|
94
|
+
The next protocol milestone will parse official v1.0 envelopes and schemas into an internal trusted render plan. It will not evolve the custom `0.1` object into a competing wire protocol. See the [compatibility matrix and conformance roadmap](https://github.com/pablospaniard/mcp-native/blob/main/docs/standards-compatibility.md).
|
|
95
|
+
|
|
68
96
|
## Supported surface
|
|
69
97
|
|
|
70
98
|
| Node | Required fields | Purpose |
|
|
@@ -78,25 +106,33 @@ The only supported action is `{ type: "tool", name, arguments? }`. Arguments mus
|
|
|
78
106
|
|
|
79
107
|
## Public API
|
|
80
108
|
|
|
81
|
-
| Export
|
|
82
|
-
|
|
|
83
|
-
| `
|
|
84
|
-
| `
|
|
85
|
-
| `
|
|
86
|
-
| `
|
|
87
|
-
|
|
|
109
|
+
| Export | Purpose |
|
|
110
|
+
| -------------------------------------------------- | ---------------------------------------------------------------- |
|
|
111
|
+
| `resolveA2uiResourceFromToolResult` | Reads and parses the single explicit A2UI link in a tool result. |
|
|
112
|
+
| `parseA2uiSurface` | Validates input and returns a typed `A2uiSurface`. |
|
|
113
|
+
| `A2uiResourceError`, `A2uiParseError` | Specific resolution and parsing failures. |
|
|
114
|
+
| `A2UI_MIME_TYPE`, `A2UI_VERSION` | Exact media type and current proof-of-concept version. |
|
|
115
|
+
| `A2UI_MAX_DEPTH`, `A2UI_MAX_NODES` | Container-tree complexity limits. |
|
|
116
|
+
| `A2UI_MAX_SOURCE_LENGTH`, `A2UI_MAX_STRING_LENGTH` | Serialized-input and string-field limits. |
|
|
117
|
+
| `ResolvedA2uiResource` | URI, MIME type, and validated surface returned by the resolver. |
|
|
118
|
+
| `A2uiSurface`, `A2uiNode` | Validated surface and node unions. |
|
|
119
|
+
| Node interfaces | Typed container, text, button, and text-input nodes. |
|
|
88
120
|
|
|
89
121
|
## Security behavior
|
|
90
122
|
|
|
91
123
|
- Input is treated as untrusted at the parser boundary.
|
|
92
|
-
-
|
|
93
|
-
-
|
|
124
|
+
- Resolution requires an exact MIME type, URI match, and unambiguous text content.
|
|
125
|
+
- Errored tool results and binary A2UI resources are rejected.
|
|
126
|
+
- Unknown surface versions, node types, action types, and undeclared fields are rejected.
|
|
127
|
+
- Serialized surfaces, string fields, and tool-argument JSON graphs have fixed complexity limits.
|
|
128
|
+
- Tool arguments are recursively constrained to finite, acyclic JSON values in plain objects.
|
|
129
|
+
- JSON keys such as `__proto__` are preserved as ordinary own data properties without changing object prototypes.
|
|
94
130
|
- Parsing never resolves components or executes server-provided code.
|
|
95
131
|
- Successful parsing does not grant device capabilities or permission to call a tool; the host still owns those decisions.
|
|
96
132
|
|
|
97
133
|
## Next layer
|
|
98
134
|
|
|
99
|
-
Use [`@mcp-native/react-native`](https://www.npmjs.com/package/@mcp-native/react-native) to convert a validated surface into a trusted native render plan, or install [`mcp-native`](https://www.npmjs.com/package/mcp-native) for the
|
|
135
|
+
Use [`@mcp-native/react-native`](https://www.npmjs.com/package/@mcp-native/react-native) to convert a validated surface into a trusted native render plan, or install [`mcp-native`](https://www.npmjs.com/package/mcp-native) for the combined runtime and UI APIs.
|
|
100
136
|
|
|
101
137
|
## License
|
|
102
138
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
|
-
import type { ToolAction } from "@mcp-native/core";
|
|
1
|
+
import type { McpReadResourceResult, McpToolCallResult, ToolAction } from "@mcp-native/core";
|
|
2
2
|
export declare const A2UI_VERSION: "0.1";
|
|
3
|
+
export declare const A2UI_MIME_TYPE: "application/a2ui+json";
|
|
4
|
+
/** Maximum nesting depth for container trees (root is depth 0). */
|
|
5
|
+
export declare const A2UI_MAX_DEPTH = 32;
|
|
6
|
+
/** Maximum number of nodes allowed in a single surface. */
|
|
7
|
+
export declare const A2UI_MAX_NODES = 256;
|
|
8
|
+
/** Maximum UTF-16 code units accepted in a serialized surface. */
|
|
9
|
+
export declare const A2UI_MAX_SOURCE_LENGTH = 1048576;
|
|
10
|
+
/** Maximum UTF-16 code units accepted in one surface string field. */
|
|
11
|
+
export declare const A2UI_MAX_STRING_LENGTH = 65536;
|
|
3
12
|
interface A2uiNodeBase {
|
|
4
13
|
readonly id: string;
|
|
5
14
|
}
|
|
@@ -27,9 +36,25 @@ export interface A2uiSurface {
|
|
|
27
36
|
readonly version: typeof A2UI_VERSION;
|
|
28
37
|
readonly root: A2uiNode;
|
|
29
38
|
}
|
|
39
|
+
export interface A2uiResourceReader {
|
|
40
|
+
readResource(uri: string): Promise<McpReadResourceResult>;
|
|
41
|
+
}
|
|
42
|
+
export interface ResolvedA2uiResource {
|
|
43
|
+
readonly uri: string;
|
|
44
|
+
readonly mimeType: typeof A2UI_MIME_TYPE;
|
|
45
|
+
readonly surface: A2uiSurface;
|
|
46
|
+
}
|
|
30
47
|
export declare class A2uiParseError extends Error {
|
|
48
|
+
constructor(message: string, options?: ErrorOptions);
|
|
49
|
+
}
|
|
50
|
+
export declare class A2uiResourceError extends Error {
|
|
31
51
|
constructor(message: string);
|
|
32
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Resolves the single explicitly typed A2UI resource link in a successful
|
|
55
|
+
* tool result, reads it through the host client, and validates its surface.
|
|
56
|
+
*/
|
|
57
|
+
export declare function resolveA2uiResourceFromToolResult(reader: A2uiResourceReader, toolResult: McpToolCallResult): Promise<ResolvedA2uiResource>;
|
|
33
58
|
export declare function parseA2uiSurface(input: string | unknown): A2uiSurface;
|
|
34
59
|
export {};
|
|
35
60
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,qBAAqB,EACrB,iBAAiB,EACjB,UAAU,EACX,MAAM,kBAAkB,CAAC;AAE1B,eAAO,MAAM,YAAY,EAAG,KAAc,CAAC;AAC3C,eAAO,MAAM,cAAc,EAAG,uBAAgC,CAAC;AAE/D,mEAAmE;AACnE,eAAO,MAAM,cAAc,KAAK,CAAC;AACjC,2DAA2D;AAC3D,eAAO,MAAM,cAAc,MAAM,CAAC;AAClC,kEAAkE;AACl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AQ,CAAC,QAAQ,EAAE,OAAO,cAAc,CAAC;IACzC,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;CAC/B;AAED,qBAAa,cAAe,SAAQ,KAAK;IACvC,YAAY,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,EAGlD;CACF;AAED,qBAAa,iBAAkB,SAAQ,KAAK;IAC1C,YAAY,OAAO,EAAE,MAAM,EAG1B;CACF;AAED;;;GAGG;AACH,wBAAsB,iCAAiC,CACrD,MAAM,EAAE,kBAAkB,EAC1B,UAAU,EAAE,iBAAiB,GAC5B,OAAO,CAAC,oBAAoB,CAAC,CAuC/B;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,GAAG,WAAW,CA2BrE"}
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,63 @@
|
|
|
1
|
+
import { parseMcpNativeAction } from "@mcp-native/core";
|
|
1
2
|
export const A2UI_VERSION = "0.1";
|
|
3
|
+
export const A2UI_MIME_TYPE = "application/a2ui+json";
|
|
4
|
+
/** Maximum nesting depth for container trees (root is depth 0). */
|
|
5
|
+
export const A2UI_MAX_DEPTH = 32;
|
|
6
|
+
/** Maximum number of nodes allowed in a single surface. */
|
|
7
|
+
export const A2UI_MAX_NODES = 256;
|
|
8
|
+
/** Maximum UTF-16 code units accepted in a serialized surface. */
|
|
9
|
+
export const A2UI_MAX_SOURCE_LENGTH = 1_048_576;
|
|
10
|
+
/** Maximum UTF-16 code units accepted in one surface string field. */
|
|
11
|
+
export const A2UI_MAX_STRING_LENGTH = 65_536;
|
|
2
12
|
export class A2uiParseError extends Error {
|
|
13
|
+
constructor(message, options) {
|
|
14
|
+
super(message, options);
|
|
15
|
+
this.name = "A2uiParseError";
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export class A2uiResourceError extends Error {
|
|
3
19
|
constructor(message) {
|
|
4
20
|
super(message);
|
|
5
|
-
this.name = "
|
|
21
|
+
this.name = "A2uiResourceError";
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Resolves the single explicitly typed A2UI resource link in a successful
|
|
26
|
+
* tool result, reads it through the host client, and validates its surface.
|
|
27
|
+
*/
|
|
28
|
+
export async function resolveA2uiResourceFromToolResult(reader, toolResult) {
|
|
29
|
+
if (toolResult.isError !== undefined && typeof toolResult.isError !== "boolean") {
|
|
30
|
+
throw new A2uiResourceError("Expected tool result.isError to be a boolean");
|
|
6
31
|
}
|
|
32
|
+
if (toolResult.isError === true) {
|
|
33
|
+
throw new A2uiResourceError("Cannot resolve an A2UI resource from an errored tool result");
|
|
34
|
+
}
|
|
35
|
+
const links = expectContentArray(toolResult.content).flatMap((block, index) => parseA2uiResourceLink(block, `tool result.content[${index}]`));
|
|
36
|
+
if (links.length !== 1) {
|
|
37
|
+
throw new A2uiResourceError(`Expected exactly one ${A2UI_MIME_TYPE} resource link, received ${links.length}`);
|
|
38
|
+
}
|
|
39
|
+
const link = links[0];
|
|
40
|
+
const readResult = await reader.readResource(link.uri);
|
|
41
|
+
const resources = expectResourceContents(readResult).filter((resource) => resource.uri === link.uri && resource.mimeType === A2UI_MIME_TYPE);
|
|
42
|
+
if (resources.length !== 1) {
|
|
43
|
+
throw new A2uiResourceError(`Expected exactly one ${A2UI_MIME_TYPE} text resource for ${link.uri}, received ${resources.length}`);
|
|
44
|
+
}
|
|
45
|
+
const resource = resources[0];
|
|
46
|
+
if (typeof resource.text !== "string" || resource.blob !== undefined) {
|
|
47
|
+
throw new A2uiResourceError(`Expected a text-only A2UI resource for ${link.uri}`);
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
uri: link.uri,
|
|
51
|
+
mimeType: A2UI_MIME_TYPE,
|
|
52
|
+
surface: parseA2uiSurface(resource.text),
|
|
53
|
+
};
|
|
7
54
|
}
|
|
8
55
|
export function parseA2uiSurface(input) {
|
|
9
56
|
let value = input;
|
|
10
57
|
if (typeof input === "string") {
|
|
58
|
+
if (input.length > A2UI_MAX_SOURCE_LENGTH) {
|
|
59
|
+
throw new A2uiParseError(`A2UI source exceeds maximum length of ${A2UI_MAX_SOURCE_LENGTH}`);
|
|
60
|
+
}
|
|
11
61
|
try {
|
|
12
62
|
value = JSON.parse(input);
|
|
13
63
|
}
|
|
@@ -17,29 +67,44 @@ export function parseA2uiSurface(input) {
|
|
|
17
67
|
}
|
|
18
68
|
}
|
|
19
69
|
const surface = expectObject(value, "surface");
|
|
70
|
+
expectOnlyKeys(surface, ["root", "version"], "surface");
|
|
20
71
|
const version = expectString(surface.version, "surface.version");
|
|
21
72
|
if (version !== A2UI_VERSION) {
|
|
22
73
|
throw new A2uiParseError(`Unsupported A2UI version: ${version}`);
|
|
23
74
|
}
|
|
75
|
+
const seenIds = new Set();
|
|
24
76
|
return {
|
|
25
77
|
version: A2UI_VERSION,
|
|
26
|
-
root: parseNode(surface.root, "surface.root"),
|
|
78
|
+
root: parseNode(surface.root, "surface.root", seenIds, 0),
|
|
27
79
|
};
|
|
28
80
|
}
|
|
29
|
-
function parseNode(value, path) {
|
|
81
|
+
function parseNode(value, path, seenIds, depth) {
|
|
82
|
+
if (depth > A2UI_MAX_DEPTH) {
|
|
83
|
+
throw new A2uiParseError(`A2UI surface exceeds maximum depth of ${A2UI_MAX_DEPTH} at ${path}`);
|
|
84
|
+
}
|
|
85
|
+
if (seenIds.size >= A2UI_MAX_NODES) {
|
|
86
|
+
throw new A2uiParseError(`A2UI surface exceeds maximum of ${A2UI_MAX_NODES} nodes`);
|
|
87
|
+
}
|
|
30
88
|
const node = expectObject(value, path);
|
|
31
89
|
const id = expectString(node.id, `${path}.id`);
|
|
90
|
+
if (seenIds.has(id)) {
|
|
91
|
+
throw new A2uiParseError(`Duplicate node id at ${path}: ${id}`);
|
|
92
|
+
}
|
|
93
|
+
seenIds.add(id);
|
|
32
94
|
const type = expectString(node.type, `${path}.type`);
|
|
33
95
|
switch (type) {
|
|
34
96
|
case "container":
|
|
97
|
+
expectOnlyKeys(node, ["children", "id", "type"], path);
|
|
35
98
|
return {
|
|
36
99
|
id,
|
|
37
100
|
type,
|
|
38
|
-
children: expectArray(node.children, `${path}.children`).map((child, index) => parseNode(child, `${path}.children[${index}]
|
|
101
|
+
children: expectArray(node.children, `${path}.children`).map((child, index) => parseNode(child, `${path}.children[${index}]`, seenIds, depth + 1)),
|
|
39
102
|
};
|
|
40
103
|
case "text":
|
|
104
|
+
expectOnlyKeys(node, ["id", "text", "type"], path);
|
|
41
105
|
return { id, type, text: expectString(node.text, `${path}.text`) };
|
|
42
106
|
case "button":
|
|
107
|
+
expectOnlyKeys(node, ["action", "id", "label", "type"], path);
|
|
43
108
|
return {
|
|
44
109
|
id,
|
|
45
110
|
type,
|
|
@@ -47,6 +112,7 @@ function parseNode(value, path) {
|
|
|
47
112
|
action: parseToolAction(node.action, `${path}.action`),
|
|
48
113
|
};
|
|
49
114
|
case "text-input": {
|
|
115
|
+
expectOnlyKeys(node, ["binding", "id", "label", "type", "value"], path);
|
|
50
116
|
const label = expectString(node.label, `${path}.label`);
|
|
51
117
|
const valueField = optionalString(node.value, `${path}.value`);
|
|
52
118
|
const binding = optionalString(node.binding, `${path}.binding`);
|
|
@@ -63,26 +129,95 @@ function parseNode(value, path) {
|
|
|
63
129
|
}
|
|
64
130
|
}
|
|
65
131
|
function parseToolAction(value, path) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
132
|
+
try {
|
|
133
|
+
return parseMcpNativeAction(value, path);
|
|
134
|
+
}
|
|
135
|
+
catch (error) {
|
|
136
|
+
const message = error instanceof Error ? error.message : `Invalid tool action at ${path}`;
|
|
137
|
+
throw new A2uiParseError(message, { cause: error });
|
|
70
138
|
}
|
|
71
|
-
const arguments_ = action.arguments;
|
|
72
|
-
return {
|
|
73
|
-
type,
|
|
74
|
-
name: expectString(action.name, `${path}.name`),
|
|
75
|
-
...(arguments_ === undefined
|
|
76
|
-
? {}
|
|
77
|
-
: { arguments: expectJsonObject(arguments_, `${path}.arguments`) }),
|
|
78
|
-
};
|
|
79
139
|
}
|
|
80
140
|
function expectObject(value, path) {
|
|
81
141
|
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
82
142
|
throw new A2uiParseError(`Expected an object at ${path}`);
|
|
83
143
|
}
|
|
144
|
+
const prototype = Object.getPrototypeOf(value);
|
|
145
|
+
if (prototype !== Object.prototype && prototype !== null) {
|
|
146
|
+
throw new A2uiParseError(`Expected a plain object at ${path}`);
|
|
147
|
+
}
|
|
148
|
+
const ownProperties = Object.create(null);
|
|
149
|
+
for (const key of Object.keys(value)) {
|
|
150
|
+
ownProperties[key] = value[key];
|
|
151
|
+
}
|
|
152
|
+
return ownProperties;
|
|
153
|
+
}
|
|
154
|
+
function expectContentArray(value) {
|
|
155
|
+
if (!Array.isArray(value)) {
|
|
156
|
+
throw new A2uiResourceError("Expected an array at tool result.content");
|
|
157
|
+
}
|
|
84
158
|
return value;
|
|
85
159
|
}
|
|
160
|
+
function parseA2uiResourceLink(value, path) {
|
|
161
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
162
|
+
throw new A2uiResourceError(`Expected a content object at ${path}`);
|
|
163
|
+
}
|
|
164
|
+
const block = value;
|
|
165
|
+
if (typeof block.type !== "string") {
|
|
166
|
+
throw new A2uiResourceError(`Expected a content type at ${path}.type`);
|
|
167
|
+
}
|
|
168
|
+
if (block.type !== "resource_link") {
|
|
169
|
+
return [];
|
|
170
|
+
}
|
|
171
|
+
if (typeof block.name !== "string") {
|
|
172
|
+
throw new A2uiResourceError(`Expected a string at ${path}.name`);
|
|
173
|
+
}
|
|
174
|
+
if (typeof block.uri !== "string") {
|
|
175
|
+
throw new A2uiResourceError(`Expected a string at ${path}.uri`);
|
|
176
|
+
}
|
|
177
|
+
if (block.mimeType !== undefined && typeof block.mimeType !== "string") {
|
|
178
|
+
throw new A2uiResourceError(`Expected a string at ${path}.mimeType`);
|
|
179
|
+
}
|
|
180
|
+
return block.mimeType === A2UI_MIME_TYPE ? [{ uri: block.uri }] : [];
|
|
181
|
+
}
|
|
182
|
+
function expectResourceContents(value) {
|
|
183
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
184
|
+
throw new A2uiResourceError("Expected an object from resources/read");
|
|
185
|
+
}
|
|
186
|
+
const contents = value.contents;
|
|
187
|
+
if (!Array.isArray(contents)) {
|
|
188
|
+
throw new A2uiResourceError("Expected an array at resource result.contents");
|
|
189
|
+
}
|
|
190
|
+
return contents.map((content, index) => {
|
|
191
|
+
if (content === null || typeof content !== "object" || Array.isArray(content)) {
|
|
192
|
+
throw new A2uiResourceError(`Expected an object at resource result.contents[${index}]`);
|
|
193
|
+
}
|
|
194
|
+
const resource = content;
|
|
195
|
+
const uri = resource.uri;
|
|
196
|
+
if (typeof uri !== "string") {
|
|
197
|
+
throw new A2uiResourceError(`Expected a string at resource result.contents[${index}].uri`);
|
|
198
|
+
}
|
|
199
|
+
const mimeType = resource.mimeType;
|
|
200
|
+
if (mimeType !== undefined && typeof mimeType !== "string") {
|
|
201
|
+
throw new A2uiResourceError(`Expected a string at resource result.contents[${index}].mimeType`);
|
|
202
|
+
}
|
|
203
|
+
const text = resource.text;
|
|
204
|
+
if (text !== undefined && typeof text !== "string") {
|
|
205
|
+
throw new A2uiResourceError(`Expected a string at resource result.contents[${index}].text`);
|
|
206
|
+
}
|
|
207
|
+
const blob = resource.blob;
|
|
208
|
+
if (blob !== undefined && typeof blob !== "string") {
|
|
209
|
+
throw new A2uiResourceError(`Expected a string at resource result.contents[${index}].blob`);
|
|
210
|
+
}
|
|
211
|
+
const common = {
|
|
212
|
+
uri,
|
|
213
|
+
...(mimeType === undefined ? {} : { mimeType }),
|
|
214
|
+
};
|
|
215
|
+
if ((text === undefined) === (blob === undefined)) {
|
|
216
|
+
throw new A2uiResourceError(`Expected exactly one of text or blob at resource result.contents[${index}]`);
|
|
217
|
+
}
|
|
218
|
+
return text === undefined ? { ...common, blob: blob } : { ...common, text };
|
|
219
|
+
});
|
|
220
|
+
}
|
|
86
221
|
function expectArray(value, path) {
|
|
87
222
|
if (!Array.isArray(value)) {
|
|
88
223
|
throw new A2uiParseError(`Expected an array at ${path}`);
|
|
@@ -93,29 +228,20 @@ function expectString(value, path) {
|
|
|
93
228
|
if (typeof value !== "string") {
|
|
94
229
|
throw new A2uiParseError(`Expected a string at ${path}`);
|
|
95
230
|
}
|
|
231
|
+
if (value.length > A2UI_MAX_STRING_LENGTH) {
|
|
232
|
+
throw new A2uiParseError(`String at ${path} exceeds maximum length of ${A2UI_MAX_STRING_LENGTH}`);
|
|
233
|
+
}
|
|
96
234
|
return value;
|
|
97
235
|
}
|
|
98
236
|
function optionalString(value, path) {
|
|
99
237
|
return value === undefined ? undefined : expectString(value, path);
|
|
100
238
|
}
|
|
101
|
-
function
|
|
102
|
-
const
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
return result;
|
|
108
|
-
}
|
|
109
|
-
function expectJsonValue(value, path) {
|
|
110
|
-
if (value === null ||
|
|
111
|
-
typeof value === "boolean" ||
|
|
112
|
-
typeof value === "number" ||
|
|
113
|
-
typeof value === "string") {
|
|
114
|
-
return value;
|
|
115
|
-
}
|
|
116
|
-
if (Array.isArray(value)) {
|
|
117
|
-
return value.map((child, index) => expectJsonValue(child, `${path}[${index}]`));
|
|
239
|
+
function expectOnlyKeys(object, allowedKeys, path) {
|
|
240
|
+
const allowed = new Set(allowedKeys);
|
|
241
|
+
for (const key of Object.keys(object)) {
|
|
242
|
+
if (!allowed.has(key)) {
|
|
243
|
+
throw new A2uiParseError(`Unsupported field ${JSON.stringify(key)} at ${path}`);
|
|
244
|
+
}
|
|
118
245
|
}
|
|
119
|
-
return expectJsonObject(value, path);
|
|
120
246
|
}
|
|
121
247
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":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AAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,cAAc,CAAC,KAAc,EAAE,IAAY;IAClD,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AACrE,CAAC;AAED,SAAS,cAAc,CACrB,MAA+B,EAC/B,WAA8B,EAC9B,IAAY;IAEZ,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,WAAW,CAAC,CAAC;IACrC,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QACtC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YACtB,MAAM,IAAI,cAAc,CAAC,qBAAqB,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;QAClF,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mcp-native/a2ui",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "A2UI parsing and bindings for MCP Native.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"a2ui",
|
|
@@ -37,6 +37,6 @@
|
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@mcp-native/core": "^0.0
|
|
40
|
+
"@mcp-native/core": "^0.1.0"
|
|
41
41
|
}
|
|
42
42
|
}
|