apps 0.0.1-beta.21 → 0.0.1-beta.22

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.
@@ -38,15 +38,21 @@ export interface McpConnection {
38
38
  readonly timeoutMs: number;
39
39
  }
40
40
  export { ToolAnnotations as McpToolAnnotations } from "./tools.js";
41
- /** Native MCP result semantics. Protocol/transport failures use the Effect error channel. */
41
+ /**
42
+ * Native MCP result semantics, and the value every MCP tool call returns. A tool's output
43
+ * schema is built from this declaration. Protocol/transport failures use the Effect error channel.
44
+ */
42
45
  export declare const McpToolResult: Schema.Struct<{
43
46
  readonly content: Schema.$Array<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
44
- readonly structuredContent: Schema.optional<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
45
- readonly isError: Schema.optional<Schema.Boolean>;
46
- readonly _meta: Schema.optional<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
47
+ readonly structuredContent: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
48
+ readonly isError: Schema.optionalKey<Schema.Boolean>;
49
+ readonly _meta: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
47
50
  }>;
48
51
  export type McpToolResult = typeof McpToolResult.Type;
49
- /** Remote metadata. Input/output schemas remain upstream JSON Schema documents. */
52
+ /**
53
+ * Remote metadata. Input/output schemas remain upstream JSON Schema documents; the upstream
54
+ * output schema describes only a result's `structuredContent`.
55
+ */
50
56
  export declare const McpToolMetadata: Schema.Struct<{
51
57
  readonly name: Schema.String;
52
58
  readonly title: Schema.optional<Schema.String>;
@@ -83,10 +89,15 @@ export type McpServerHeader = typeof McpServerHeader.Type;
83
89
  export interface McpToolContext {
84
90
  readonly elicit?: Elicit;
85
91
  }
86
- /** A tool bound to one evaluation's account; do not reuse it with another account. */
87
- export interface McpTool extends McpToolMetadata {
92
+ /**
93
+ * A tool bound to one evaluation's account; do not reuse it with another account. `output`
94
+ * decodes and describes the `McpToolResult` that `run` returns, with the upstream output schema
95
+ * under `structuredContent`.
96
+ */
97
+ export interface McpTool extends Omit<McpToolMetadata, "outputSchema"> {
88
98
  readonly description: string;
89
99
  readonly input: Schema.Decoder<JsonValue>;
100
+ readonly output: Schema.Decoder<JsonValue>;
90
101
  readonly readOnly?: boolean;
91
102
  readonly run: (context: McpToolContext, input: JsonValue) => Effect.Effect<McpToolResult, McpError | ProviderError | ElicitationFailed>;
92
103
  }
@@ -17,8 +17,12 @@ export interface AppOperation<Input = unknown, Output = unknown> {
17
17
  readonly annotations?: ToolAnnotations;
18
18
  readonly _meta?: JsonObject;
19
19
  readonly input: Schema.Decoder<Input>;
20
+ /** Checks every value `run` returns and is the output schema the operation is described with. */
20
21
  readonly output?: Schema.Decoder<Output>;
21
- /** Upstream protocol result metadata; the protocol adapter validates its own result envelope. */
22
+ /**
23
+ * An upstream protocol's description of the value `run` returns, used only when `output` is
24
+ * absent. The host does not check it, so declare `output` when the result can be checked.
25
+ */
22
26
  readonly outputSchema?: JsonObject;
23
27
  readonly approval?: Approval<Input>;
24
28
  readonly run: (context: OperationContext, input: Input) => Effect.Effect<Output, unknown>;
@@ -12,9 +12,9 @@ export declare const mcpCall: (client: Client, name: string, input: JsonObject,
12
12
  }[];
13
13
  readonly _meta?: {
14
14
  readonly [x: string]: Schema.Json;
15
- } | undefined;
15
+ };
16
16
  readonly structuredContent?: {
17
17
  readonly [x: string]: Schema.Json;
18
- } | undefined;
19
- readonly isError?: boolean | undefined;
18
+ };
19
+ readonly isError?: boolean;
20
20
  }, ProviderError | ElicitationFailed | McpError, never>;
@@ -56,11 +56,11 @@ export declare function mcpClient(withClient: WithMcpClient, timeoutMs: number,
56
56
  }[];
57
57
  readonly _meta?: {
58
58
  readonly [x: string]: Schema.Json;
59
- } | undefined;
59
+ };
60
60
  readonly structuredContent?: {
61
61
  readonly [x: string]: Schema.Json;
62
- } | undefined;
63
- readonly isError?: boolean | undefined;
62
+ };
63
+ readonly isError?: boolean;
64
64
  }, ProviderError | import("../index.js").ElicitationFailed | McpError, never>;
65
65
  };
66
66
  /** Transport-independent operations consumed by the app tool adapter. */
@@ -46,11 +46,11 @@ export declare const mcpClientEffect: (input: McpToolsOptions, changed?: Effect.
46
46
  }[];
47
47
  readonly _meta?: {
48
48
  readonly [x: string]: Schema.Json;
49
- } | undefined;
49
+ };
50
50
  readonly structuredContent?: {
51
51
  readonly [x: string]: Schema.Json;
52
- } | undefined;
53
- readonly isError?: boolean | undefined;
52
+ };
53
+ readonly isError?: boolean;
54
54
  }, ProviderError | import("../index.js").ElicitationFailed | McpError, never>;
55
55
  }, McpError, never>;
56
56
  /** Discover and compile all tools for connection probes and low-level consumers. */
@@ -13,6 +13,9 @@ interface ProtocolOperation {
13
13
  readonly annotations?: ToolAnnotations | undefined;
14
14
  readonly _meta?: JsonObject | undefined;
15
15
  readonly input: Schema.Decoder<JsonValue>;
16
+ /** Checks and describes every returned value. */
17
+ readonly output?: Schema.Decoder<JsonValue> | undefined;
18
+ /** Describes the returned value without checking it; ignored when `output` is declared. */
16
19
  readonly outputSchema?: JsonObject | undefined;
17
20
  readonly run: (context: OperationContext, input: JsonValue) => Effect.Effect<unknown, unknown>;
18
21
  }
@@ -120,6 +120,14 @@ export declare const compileJsonSchemaDecoder: (document: JsonObject) => Effect.
120
120
  };
121
121
  }, ValidationError, never>;
122
122
  export declare const lazyJsonSchemaDecoder: (document: () => JsonObject) => Effect.Effect<EffectSchema.declareConstructor<EffectSchema.Json, EffectSchema.Json, readonly [], EffectSchema.Json>, never, never>;
123
+ /**
124
+ * A lazy decoder and the compilation it decodes with. Running `compile` first lets a caller
125
+ * reject an unsupported schema before a side effect whose result the decoder will check.
126
+ */
127
+ export declare const preparedJsonSchemaDecoder: (document: JsonObject) => {
128
+ decoder: EffectSchema.declareConstructor<EffectSchema.Json, EffectSchema.Json, readonly [], EffectSchema.Json>;
129
+ compile: Effect.Effect<EffectSchema.Decoder<EffectSchema.Json, never>, ValidationError, never>;
130
+ };
123
131
  /** Preserve the JSON document; compile its validator only when a value is first decoded. */
124
132
  export declare const jsonSchemaDecoder: (input: unknown) => Effect.Effect<EffectSchema.declareConstructor<EffectSchema.Json, EffectSchema.Json, readonly [], EffectSchema.Json>, ValidationError, never>;
125
133
  /** Import JSON metadata now; unsupported schemas and invalid values fail when parsed. */