@adhd/apigen-engine-runtime 0.2.4 → 0.3.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/CHANGELOG.md +30 -0
- package/README.md +13 -0
- package/index.js +1 -1
- package/index.mjs +1888 -2025
- package/lib/mcp-output-schema.d.ts +26 -6
- package/package.json +5 -5
|
@@ -1,8 +1,23 @@
|
|
|
1
1
|
/** Result of adapting a composed-schema `output` fragment for MCP's `outputSchema` field. */
|
|
2
2
|
export interface McpOutputAdapter {
|
|
3
|
-
/** The MCP `Tool.outputSchema` value, or `undefined` when
|
|
3
|
+
/** The MCP `Tool.outputSchema` value, or `undefined` when the return is not
|
|
4
|
+
* already a top-level `type:"object"` (nothing protocol-representable to
|
|
5
|
+
* advertise — see ADR-0004). */
|
|
4
6
|
outputSchema: Record<string, unknown> | undefined;
|
|
5
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Whether a matching `structuredContent` should be emitted for this output.
|
|
9
|
+
*
|
|
10
|
+
* `true` iff the return is already a top-level `type:"object"` — the only
|
|
11
|
+
* case in which an `outputSchema` is emitted at all; `false` for a
|
|
12
|
+
* union/array/scalar/void return, which is passed through flat on `content`
|
|
13
|
+
* alone (ADR-0004).
|
|
14
|
+
*
|
|
15
|
+
* Retained under its historical name because the generated host templates
|
|
16
|
+
* destructure `wrapped` and pass it straight to `wrapMcpStructuredContent`
|
|
17
|
+
* (as do already-generated hosts out in the wild). Since ADR-0004 it no
|
|
18
|
+
* longer means "the schema was wrapped under `result`" — nothing is ever
|
|
19
|
+
* wrapped. Read it as `emitStructuredContent`.
|
|
20
|
+
*/
|
|
6
21
|
wrapped: boolean;
|
|
7
22
|
}
|
|
8
23
|
/**
|
|
@@ -14,8 +29,13 @@ export interface McpOutputAdapter {
|
|
|
14
29
|
*/
|
|
15
30
|
export declare function buildMcpOutputSchema(output: unknown): McpOutputAdapter;
|
|
16
31
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* `
|
|
32
|
+
* Returns the MCP `structuredContent` for a tool's actual return value.
|
|
33
|
+
*
|
|
34
|
+
* `emit` is `McpOutputAdapter.wrapped` for the SAME `output` fragment: only an
|
|
35
|
+
* already-object return emits `structuredContent`, and it is the value itself
|
|
36
|
+
* — never wrapped under `result` (ADR-0004). A non-plain-object value (or an
|
|
37
|
+
* `emit:false` non-object return) yields `undefined`: `structuredContent`
|
|
38
|
+
* (like `outputSchema`) is constrained to a plain object by the SDK, so an
|
|
39
|
+
* array/scalar must not be emitted there.
|
|
20
40
|
*/
|
|
21
|
-
export declare function wrapMcpStructuredContent(
|
|
41
|
+
export declare function wrapMcpStructuredContent(emit: boolean, value: unknown): Record<string, unknown> | undefined;
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adhd/apigen-engine-runtime",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"ajv": "^8.20.0",
|
|
6
6
|
"ajv-formats": "2.1.1",
|
|
7
7
|
"pino": "10.3.1",
|
|
8
|
-
"@adhd/apigen-core-client": "^0.3.
|
|
9
|
-
"@adhd/apigen-base-logical": "^0.1.
|
|
10
|
-
"@adhd/apigen-base-errors": "^0.2.
|
|
11
|
-
"@adhd/apigen-engine-naming": "^0.2.
|
|
8
|
+
"@adhd/apigen-core-client": "^0.3.2",
|
|
9
|
+
"@adhd/apigen-base-logical": "^0.1.3",
|
|
10
|
+
"@adhd/apigen-base-errors": "^0.2.2",
|
|
11
|
+
"@adhd/apigen-engine-naming": "^0.2.4",
|
|
12
12
|
"better-sqlite3": "12.10.0"
|
|
13
13
|
},
|
|
14
14
|
"main": "./index.js",
|