@mcp-b/webmcp-types 0.0.0-beta-20260216200013

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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 mcp-b contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,307 @@
1
+ # @mcp-b/webmcp-types
2
+
3
+ Strict TypeScript type definitions for the WebMCP core API (`navigator.modelContext`).
4
+
5
+ Zero dependencies. Zero runtime. Just `.d.ts` declarations.
6
+
7
+ ## What's included
8
+
9
+ - Global `Navigator` augmentation (`navigator.modelContext`)
10
+ - Core descriptors: tools
11
+ - Content and result payload types (`ContentBlock`, `CallToolResult`, `ResourceContents`)
12
+ - MCPB extension API types (`ModelContextExtensions`, including `callTool`)
13
+ - Tool execution client types (`ModelContextClient`, `ToolExecutionContext`)
14
+ - Typed event surface (`ToolCallEvent`)
15
+ - Pure JSON Schema inference helpers (`JsonSchemaForInference`, `InferArgsFromInputSchema`, `ToolDescriptorFromSchema`, `ToolResultFromOutputSchema`)
16
+
17
+ ## Install
18
+
19
+ ```bash
20
+ npm install --save-dev @mcp-b/webmcp-types
21
+ # or
22
+ pnpm add -D @mcp-b/webmcp-types
23
+ ```
24
+
25
+ If your published library exposes `@mcp-b/webmcp-types` in its own `.d.ts` surface, install it as a production dependency instead of a dev dependency.
26
+
27
+ ## Usage
28
+
29
+ ### Enable global types
30
+
31
+ TypeScript does not always include global declarations from regular npm packages automatically.
32
+ Use one of the following activation methods:
33
+
34
+ 1. Add to `tsconfig.json`:
35
+
36
+ ```json
37
+ {
38
+ "compilerOptions": {
39
+ "types": ["@mcp-b/webmcp-types"]
40
+ }
41
+ }
42
+ ```
43
+
44
+ 2. Add a triple-slash reference in a global `.d.ts` file:
45
+
46
+ ```typescript
47
+ /// <reference types="@mcp-b/webmcp-types" />
48
+ ```
49
+
50
+ 3. Add a type-only import in your app/library entry:
51
+
52
+ ```typescript
53
+ import type {} from '@mcp-b/webmcp-types';
54
+ ```
55
+
56
+ ### Global API example
57
+
58
+ After activating the types, `navigator.modelContext` is available on `Navigator`:
59
+
60
+ ```typescript
61
+ // No import needed - types are globally augmented
62
+ navigator.modelContext.registerTool({
63
+ name: 'search',
64
+ description: 'Search the web',
65
+ inputSchema: {
66
+ type: 'object',
67
+ properties: { query: { type: 'string' } },
68
+ required: ['query'],
69
+ },
70
+ execute: async ({ query }) => ({
71
+ content: [{ type: 'text', text: `Results for: ${query}` }],
72
+ }),
73
+ });
74
+ ```
75
+
76
+ ### Individual imports
77
+
78
+ ```typescript
79
+ import type {
80
+ ElicitationParams,
81
+ ElicitationResult,
82
+ InferArgsFromInputSchema,
83
+ JsonSchemaForInference,
84
+ LooseContentBlock,
85
+ MaybePromise,
86
+ ModelContext,
87
+ ModelContextClient,
88
+ ModelContextExtensions,
89
+ ToolExecutionContext,
90
+ ToolDescriptor,
91
+ ToolDescriptorFromSchema,
92
+ ToolResultFromOutputSchema,
93
+ TypedModelContext,
94
+ CallToolResult,
95
+ } from '@mcp-b/webmcp-types';
96
+ ```
97
+
98
+ ### Sync or async execute handlers
99
+
100
+ `execute` can return a plain result or a `Promise`.
101
+
102
+ ```typescript
103
+ import type { CallToolResult, ToolDescriptor } from '@mcp-b/webmcp-types';
104
+
105
+ const syncTool: ToolDescriptor<{ message: string }, CallToolResult, 'sync_echo'> = {
106
+ name: 'sync_echo',
107
+ description: 'Synchronous echo',
108
+ inputSchema: {
109
+ type: 'object',
110
+ properties: { message: { type: 'string' } },
111
+ required: ['message'],
112
+ },
113
+ execute(args) {
114
+ return {
115
+ content: [{ type: 'text', text: args.message }],
116
+ };
117
+ },
118
+ };
119
+ ```
120
+
121
+ ### Strict and loose content blocks
122
+
123
+ `CallToolResult.content` accepts strict MCP content blocks and pragmatic loose objects.
124
+
125
+ ```typescript
126
+ import type { CallToolResult } from '@mcp-b/webmcp-types';
127
+
128
+ const result: CallToolResult = {
129
+ content: [
130
+ { type: 'text', text: 'strict block' },
131
+ { text: 'loose block', data: 'opaque payload' },
132
+ ],
133
+ };
134
+ ```
135
+
136
+ ### Typed tool descriptors
137
+
138
+ ```typescript
139
+ import type { ToolDescriptor } from '@mcp-b/webmcp-types';
140
+
141
+ type SearchArgs = {
142
+ query: string;
143
+ limit?: number;
144
+ };
145
+
146
+ const searchTool: ToolDescriptor<SearchArgs> = {
147
+ name: 'search',
148
+ description: 'Search indexed docs',
149
+ inputSchema: {
150
+ type: 'object',
151
+ properties: {
152
+ query: { type: 'string' },
153
+ limit: { type: 'number' },
154
+ },
155
+ required: ['query'],
156
+ },
157
+ execute: async ({ query, limit }, context) => {
158
+ const approval = await context.requestUserInteraction(async () => ({
159
+ confirmed: true,
160
+ }));
161
+
162
+ if (
163
+ typeof approval !== 'object' ||
164
+ !approval ||
165
+ !('confirmed' in approval) ||
166
+ !approval.confirmed
167
+ ) {
168
+ return {
169
+ content: [{ type: 'text', text: 'Search cancelled by user.' }],
170
+ };
171
+ }
172
+
173
+ return {
174
+ content: [{ type: 'text', text: `Searching for "${query}" (limit: ${limit ?? 10})` }],
175
+ };
176
+ },
177
+ };
178
+ ```
179
+
180
+ ### Pure JSON Schema inference (input + output)
181
+
182
+ Inference focuses on core keywords (`type`, `properties`, `required`, `items`, `enum`, `const`) and tolerates additional schema metadata.
183
+
184
+ ```typescript
185
+ import type { JsonSchemaForInference } from '@mcp-b/webmcp-types';
186
+
187
+ const inputSchema = {
188
+ type: 'object',
189
+ properties: {
190
+ query: { type: 'string' },
191
+ limit: { type: 'integer', minimum: 1, maximum: 50 },
192
+ },
193
+ required: ['query'],
194
+ additionalProperties: false,
195
+ } as const satisfies JsonSchemaForInference;
196
+
197
+ const outputSchema = {
198
+ type: 'object',
199
+ properties: {
200
+ total: { type: 'integer' },
201
+ items: {
202
+ type: 'array',
203
+ items: { type: 'string' },
204
+ },
205
+ },
206
+ required: ['total'],
207
+ additionalProperties: false,
208
+ } as const satisfies JsonSchemaForInference;
209
+
210
+ navigator.modelContext.registerTool({
211
+ name: 'search',
212
+ description: 'Search indexed docs',
213
+ inputSchema,
214
+ outputSchema,
215
+ async execute(args) {
216
+ // args is inferred as:
217
+ // { query: string; limit?: number }
218
+ return {
219
+ content: [{ type: 'text', text: `Searching for ${args.query}` }],
220
+ // structuredContent is inferred from outputSchema as:
221
+ // { total: number; items?: string[] }
222
+ structuredContent: {
223
+ total: 1,
224
+ items: [args.query],
225
+ },
226
+ };
227
+ },
228
+ });
229
+ ```
230
+
231
+ If your schema is not a literal (for example loaded from runtime config), inference safely falls back to `Record<string, unknown>`.
232
+
233
+ ### Tool-scoped elicitation
234
+
235
+ ```typescript
236
+ import type { ModelContextExtensions } from '@mcp-b/webmcp-types';
237
+
238
+ const modelContext = navigator.modelContext as Navigator['modelContext'] & ModelContextExtensions;
239
+
240
+ modelContext.registerTool({
241
+ name: 'deploy',
242
+ description: 'Deploy current build',
243
+ inputSchema: {
244
+ type: 'object',
245
+ properties: {
246
+ environment: { type: 'string' },
247
+ },
248
+ required: ['environment'],
249
+ },
250
+ async execute({ environment }, context) {
251
+ const confirmation = await context.requestUserInteraction(async () => ({
252
+ action: 'accept',
253
+ content: { confirm: true },
254
+ }));
255
+
256
+ if (confirmation.action !== 'accept' || !confirmation.content?.confirm) {
257
+ return {
258
+ content: [{ type: 'text', text: 'Deployment cancelled.' }],
259
+ };
260
+ }
261
+
262
+ return {
263
+ content: [{ type: 'text', text: `Deployment started for ${environment}.` }],
264
+ };
265
+ },
266
+ };
267
+ ```
268
+
269
+ ### Name-aware typed context (advanced)
270
+
271
+ ```typescript
272
+ import type { CallToolResult, ToolDescriptor, TypedModelContext } from '@mcp-b/webmcp-types';
273
+
274
+ type SearchTool = ToolDescriptor<
275
+ { query: string },
276
+ CallToolResult & { structuredContent: { total: number } },
277
+ 'search'
278
+ >;
279
+
280
+ type PingTool = ToolDescriptor<Record<string, never>, CallToolResult, 'ping'>;
281
+
282
+ type AppModelContext = TypedModelContext<readonly [SearchTool, PingTool]>;
283
+ declare const modelContext: AppModelContext;
284
+
285
+ const searchResult = await modelContext.callTool({
286
+ name: 'search',
287
+ arguments: { query: 'webmcp' },
288
+ });
289
+ // searchResult is inferred from the 'search' tool result type.
290
+
291
+ await modelContext.callTool({ name: 'ping' });
292
+ // 'ping' arguments are optional because the args type is Record<string, never>.
293
+ ```
294
+
295
+ ## Relationship to Runtime Packages
296
+
297
+ | Package | Purpose |
298
+ |---------|---------|
299
+ | `@mcp-b/webmcp-types` | Type definitions only - for libraries that need to type-check against the API |
300
+ | `@mcp-b/webmcp-polyfill` | Strict core runtime polyfill for `navigator.modelContext` |
301
+ | `@mcp-b/global` | Full MCPB runtime (core + bridge extensions like `callTool`, prompts, resources) |
302
+
303
+ Use `@mcp-b/webmcp-types` when you only need types (e.g., building a library that accepts `ToolDescriptor`). Use `@mcp-b/webmcp-polyfill` for strict core runtime behavior, or `@mcp-b/global` for extension-heavy bridge workflows.
304
+
305
+ ## License
306
+
307
+ MIT
@@ -0,0 +1,297 @@
1
+ /**
2
+ * Primitive JSON value.
3
+ */
4
+ export type JsonPrimitive = string | number | boolean | null;
5
+ /**
6
+ * Object-shaped JSON value.
7
+ */
8
+ export interface JsonObject {
9
+ [key: string]: JsonValue;
10
+ }
11
+ /**
12
+ * Any valid JSON value.
13
+ */
14
+ export type JsonValue = JsonPrimitive | JsonObject | JsonValue[];
15
+ /**
16
+ * JSON Schema property definition.
17
+ *
18
+ * @see {@link https://json-schema.org/}
19
+ */
20
+ export interface InputSchemaProperty {
21
+ /**
22
+ * JSON Schema type for this property.
23
+ */
24
+ type: string;
25
+ /**
26
+ * Human-readable description of the property.
27
+ */
28
+ description?: string;
29
+ /**
30
+ * Additional JSON Schema keywords.
31
+ */
32
+ [key: string]: unknown;
33
+ }
34
+ /**
35
+ * JSON Schema definition for tool input parameters.
36
+ *
37
+ * @see {@link https://json-schema.org/}
38
+ */
39
+ export interface InputSchema {
40
+ /**
41
+ * JSON Schema type for the root value (usually `'object'` for tool args).
42
+ */
43
+ type: string;
44
+ /**
45
+ * Property definitions for object schemas.
46
+ */
47
+ properties?: Record<string, InputSchemaProperty>;
48
+ /**
49
+ * List of required property names.
50
+ */
51
+ required?: readonly string[];
52
+ /**
53
+ * Additional JSON Schema keywords.
54
+ */
55
+ [key: string]: unknown;
56
+ }
57
+ /**
58
+ * Plain text content.
59
+ */
60
+ export interface TextContent {
61
+ /**
62
+ * Discriminator for text content.
63
+ */
64
+ type: 'text';
65
+ /**
66
+ * UTF-8 text value.
67
+ */
68
+ text: string;
69
+ }
70
+ /**
71
+ * Base64-encoded image content.
72
+ */
73
+ export interface ImageContent {
74
+ /**
75
+ * Discriminator for image content.
76
+ */
77
+ type: 'image';
78
+ /**
79
+ * Base64 payload.
80
+ */
81
+ data: string;
82
+ /**
83
+ * MIME type for the encoded image.
84
+ */
85
+ mimeType: string;
86
+ }
87
+ /**
88
+ * Base64-encoded audio content.
89
+ */
90
+ export interface AudioContent {
91
+ /**
92
+ * Discriminator for audio content.
93
+ */
94
+ type: 'audio';
95
+ /**
96
+ * Base64 payload.
97
+ */
98
+ data: string;
99
+ /**
100
+ * MIME type for the encoded audio.
101
+ */
102
+ mimeType: string;
103
+ }
104
+ /**
105
+ * Text resource contents.
106
+ */
107
+ export interface TextResourceContents {
108
+ /**
109
+ * Canonical resource URI.
110
+ */
111
+ uri: string;
112
+ /**
113
+ * Optional MIME type.
114
+ */
115
+ mimeType?: string;
116
+ /**
117
+ * UTF-8 resource payload.
118
+ */
119
+ text: string;
120
+ }
121
+ /**
122
+ * Binary resource contents encoded as base64.
123
+ */
124
+ export interface BlobResourceContents {
125
+ /**
126
+ * Canonical resource URI.
127
+ */
128
+ uri: string;
129
+ /**
130
+ * Optional MIME type.
131
+ */
132
+ mimeType?: string;
133
+ /**
134
+ * Base64-encoded binary payload.
135
+ */
136
+ blob: string;
137
+ }
138
+ /**
139
+ * Resource contents returned by resource reads.
140
+ */
141
+ export type ResourceContents = TextResourceContents | BlobResourceContents;
142
+ /**
143
+ * Embedded resource content block.
144
+ */
145
+ export interface EmbeddedResource {
146
+ /**
147
+ * Discriminator for embedded resources.
148
+ */
149
+ type: 'resource';
150
+ /**
151
+ * Inlined resource contents.
152
+ */
153
+ resource: ResourceContents;
154
+ }
155
+ /**
156
+ * Link to an externally retrievable resource.
157
+ */
158
+ export interface ResourceLink {
159
+ /**
160
+ * Discriminator for resource links.
161
+ */
162
+ type: 'resource_link';
163
+ /**
164
+ * Resource URI.
165
+ */
166
+ uri: string;
167
+ /**
168
+ * Optional display name.
169
+ */
170
+ name?: string;
171
+ /**
172
+ * Optional human-readable description.
173
+ */
174
+ description?: string;
175
+ /**
176
+ * Optional MIME type hint.
177
+ */
178
+ mimeType?: string;
179
+ }
180
+ /**
181
+ * Any content block allowed in tool responses.
182
+ */
183
+ export type ContentBlock = TextContent | ImageContent | AudioContent | ResourceLink | EmbeddedResource;
184
+ /**
185
+ * Looser content block shape accepted by many MCP tool implementations.
186
+ *
187
+ * This keeps tool return typing practical while preserving strict content
188
+ * unions via {@link ContentBlock} for consumers that want discriminated checks.
189
+ */
190
+ export type LooseContentBlock = Record<string, unknown> & {
191
+ type?: string;
192
+ };
193
+ /**
194
+ * The result returned from tool execution.
195
+ *
196
+ * @see {@link https://spec.modelcontextprotocol.io/specification/server/tools/}
197
+ */
198
+ export interface CallToolResult {
199
+ /**
200
+ * Ordered content blocks to return to the model.
201
+ */
202
+ content: Array<ContentBlock | LooseContentBlock>;
203
+ /**
204
+ * Optional machine-readable payload.
205
+ */
206
+ structuredContent?: JsonObject;
207
+ /**
208
+ * Marks the result as an error response.
209
+ */
210
+ isError?: boolean;
211
+ }
212
+ /**
213
+ * Alias for {@link CallToolResult} for API consistency.
214
+ */
215
+ export type ToolResponse = CallToolResult;
216
+ /**
217
+ * Form-based elicitation request parameters.
218
+ */
219
+ export interface ElicitationFormParams {
220
+ /**
221
+ * Elicitation mode. Omit or set to `'form'` for form input.
222
+ */
223
+ mode?: 'form';
224
+ /**
225
+ * User-facing message.
226
+ */
227
+ message: string;
228
+ /**
229
+ * Requested form schema.
230
+ */
231
+ requestedSchema: {
232
+ /**
233
+ * Root schema type.
234
+ */
235
+ type: 'object';
236
+ /**
237
+ * Field definitions.
238
+ */
239
+ properties: Record<string, InputSchema>;
240
+ /**
241
+ * Required field names.
242
+ */
243
+ required?: readonly string[];
244
+ /**
245
+ * Additional schema keywords.
246
+ */
247
+ [key: string]: unknown;
248
+ };
249
+ }
250
+ /**
251
+ * URL-based elicitation request parameters.
252
+ */
253
+ export interface ElicitationUrlParams {
254
+ /**
255
+ * Elicitation mode.
256
+ */
257
+ mode: 'url';
258
+ /**
259
+ * User-facing message.
260
+ */
261
+ message: string;
262
+ /**
263
+ * Unique elicitation identifier.
264
+ */
265
+ elicitationId: string;
266
+ /**
267
+ * URL to open.
268
+ */
269
+ url: string;
270
+ }
271
+ /**
272
+ * Elicitation request parameters.
273
+ */
274
+ export type ElicitationParams = ElicitationFormParams | ElicitationUrlParams;
275
+ /**
276
+ * Result returned by an elicitation request.
277
+ */
278
+ export interface ElicitationResult {
279
+ /**
280
+ * User decision.
281
+ */
282
+ action: 'accept' | 'decline' | 'cancel';
283
+ /**
284
+ * Submitted values when `action` is `'accept'`.
285
+ */
286
+ content?: Record<string, string | number | boolean | string[]>;
287
+ }
288
+ /**
289
+ * Registration handle returned by registration methods.
290
+ */
291
+ export interface RegistrationHandle {
292
+ /**
293
+ * Unregisters the associated item.
294
+ */
295
+ unregister: () => void;
296
+ }
297
+ //# sourceMappingURL=common.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AAE7D;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,aAAa,GAAG,UAAU,GAAG,SAAS,EAAE,CAAC;AAEjE;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;IAEjD;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAE7B;;OAEG;IACH,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAMD;;GAEG;A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AiB,GAAG,qBAAqB,GAAG,oBAAoB,CAAC;AAE7E;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,MAAM,EAAE,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAAC;IAExC;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,EAAE,CAAC,CAAC;CAChE;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,UAAU,EAAE,MAAM,IAAI,CAAC;CACxB"}
@@ -0,0 +1,20 @@
1
+ import type { ModelContext, ModelContextTesting } from './model-context.js';
2
+ export type { AudioContent, BlobResourceContents, CallToolResult, ContentBlock, ElicitationFormParams, ElicitationParams, ElicitationResult, ElicitationUrlParams, EmbeddedResource, ImageContent, InputSchema, InputSchemaProperty, JsonObject, JsonPrimitive, JsonValue, LooseContentBlock, RegistrationHandle, ResourceContents, ResourceLink, TextContent, TextResourceContents, ToolResponse, } from './common.js';
3
+ export type { InferArgsFromInputSchema, InferJsonSchema, JsonSchemaArray, JsonSchemaBoolean, JsonSchemaEnumValue, JsonSchemaForInference, JsonSchemaMultiType, JsonSchemaNull, JsonSchemaNumber, JsonSchemaObject, JsonSchemaPrimitiveType, JsonSchemaString, JsonSchemaType, JsonSchemaTypeArray, } from './json-schema.js';
4
+ export type { AnyToolDescriptor, InferToolArgs, InferToolResult, ModelContext, ModelContextCore, ModelContextExtensions, ModelContextInput, ModelContextOptions, ModelContextTesting, ModelContextTestingExecuteToolOptions, ModelContextTestingPolyfillExtensions, ModelContextTestingToolInfo, ModelContextWithExtensions, ToolArgsByName, ToolByName, ToolCallEvent, ToolCallParams, ToolName, ToolResultByName, TypedModelContext, } from './model-context.js';
5
+ export type { MaybePromise, ModelContextClient, ToolAnnotations, ToolDescriptor, ToolDescriptorFromSchema, ToolExecutionContext, ToolListItem, ToolResultFromOutputSchema, } from './tool.js';
6
+ declare global {
7
+ interface Navigator {
8
+ /**
9
+ * Web Model Context API strict core surface.
10
+ */
11
+ modelContext: ModelContext;
12
+ /**
13
+ * Web Model Context testing API surface (Chromium early preview).
14
+ * @deprecated Prefer navigator.modelContext.callTool(...) and toolschanged events
15
+ * for in-page consumers. Chromium still exposes this API for testing flows.
16
+ */
17
+ modelContextTesting?: ModelContextTesting;
18
+ }
19
+ }
20
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAG5E,YAAY,EACV,YAAY,EACZ,oBAAoB,EACpB,cAAc,EACd,YAAY,EACZ,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,EACpB,gBAAgB,EAChB,YAAY,EACZ,WAAW,EACX,mBAAmB,EACnB,UAAU,EACV,aAAa,EACb,SAAS,EACT,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,EACZ,WAAW,EACX,oBAAoB,EACpB,YAAY,GACb,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,wBAAwB,EACxB,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,sBAAsB,EACtB,mBAAmB,EACnB,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,uBAAuB,EACvB,gBAAgB,EAChB,cAAc,EACd,mBAAmB,GACpB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,sBAAsB,EACtB,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,qCAAqC,EACrC,qCAAqC,EACrC,2BAA2B,EAC3B,0BAA0B,EAC1B,cAAc,EACd,UAAU,EACV,aAAa,EACb,cAAc,EACd,QAAQ,EACR,gBAAgB,EA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