@decocms/bindings 0.1.0 → 0.1.2

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 CHANGED
@@ -186,8 +186,8 @@ const isValid = checker.isImplementedBy(availableTools);
186
186
 
187
187
  The package includes pre-defined bindings for common use cases. Well-known bindings are organized in the `well-known` folder and must be imported directly:
188
188
 
189
- - **Collections**: `@decocms/bindings/well-known/collections` - Collection bindings for SQL table-like structures
190
- - **Models**: `@decocms/bindings/well-known/models` - AI model providers interface
189
+ - **Collections**: `@decocms/bindings/collections` - Collection bindings for SQL table-like structures
190
+ - **Models**: `@decocms/bindings/models` - AI model providers interface
191
191
 
192
192
  See the [Collection Bindings](#collection-bindings) and [Models Bindings](#models-bindings) sections below for detailed usage examples.
193
193
 
@@ -216,12 +216,12 @@ const workflowBinding = createResourceBinding("workflow");
216
216
 
217
217
  ## Collection Bindings
218
218
 
219
- Collection bindings provide standardized CRUD + Search operations for SQL table-like collections, compatible with TanStack DB query-collection. They are designed for database tables where each entity has a unique URI and audit trail fields.
219
+ Collection bindings provide standardized CRUD + Search operations for SQL table-like collections, compatible with TanStack DB query-collection. They are designed for database tables where each entity has a unique ID and human-readable title.
220
220
 
221
221
  ### Key Features
222
222
 
223
223
  - **SQL Table-like Structure**: Represents database tables with standardized operations
224
- - **URI-based Identification**: Uses collection URIs in format `rsc://{connectionid}/{collection_name}/{item_id}`
224
+ - **Simple Identification**: Uses human-readable `id` and `title` fields
225
225
  - **Audit Trail**: All entities must include `created_at`, `updated_at`, `created_by`, and `updated_by` fields
226
226
  - **TanStack DB Compatible**: Works seamlessly with TanStack DB's query-collection LoadSubsetOptions
227
227
  - **Type-Safe**: Full TypeScript support with Zod validation
@@ -230,7 +230,8 @@ Collection bindings provide standardized CRUD + Search operations for SQL table-
230
230
 
231
231
  All collection entity schemas must extend `BaseCollectionEntitySchema`, which requires:
232
232
 
233
- - `uri`: Collection URI in format `rsc://{connectionid}/{collection_name}/{item_id}`
233
+ - `id`: Unique identifier for the entity (string)
234
+ - `title`: Human-readable title for the entity (string)
234
235
  - `created_at`: Creation timestamp (datetime string)
235
236
  - `updated_at`: Last update timestamp (datetime string)
236
237
  - `created_by`: User who created the entity (optional string)
@@ -242,18 +243,18 @@ Collection bindings are a well-known binding pattern for SQL table-like structur
242
243
 
243
244
  ```typescript
244
245
  import { z } from "zod";
245
- import { createCollectionBindings } from "@decocms/bindings/well-known/collections";
246
+ import { createCollectionBindings } from "@decocms/bindings/collections";
246
247
  import { createBindingChecker } from "@decocms/bindings";
247
248
 
248
249
  // Define your entity schema extending the base schema
249
250
  const TodoSchema = z.object({
250
- uri: z.string(), // Collection URI: rsc://{connectionid}/todos/{item_id}
251
+ id: z.string(), // Unique identifier
252
+ title: z.string(), // Human-readable title (from base schema)
251
253
  created_at: z.string().datetime(),
252
254
  updated_at: z.string().datetime(),
253
255
  created_by: z.string().optional(),
254
256
  updated_by: z.string().optional(),
255
257
  // Your custom fields
256
- title: z.string(),
257
258
  completed: z.boolean(),
258
259
  userId: z.number(),
259
260
  });
@@ -294,26 +295,26 @@ The `createCollectionBindings` function generates tool bindings based on the `re
294
295
  - Output: `items[]`, `totalCount?`, `hasMore?`
295
296
 
296
297
  2. **GET** - `DECO_COLLECTION_{NAME}_GET`
297
- - Get a single entity by URI
298
- - Input: `uri`
298
+ - Get a single entity by ID
299
+ - Input: `id` (string)
299
300
  - Output: `item | null`
300
301
 
301
302
  **Optional operations (excluded if `readOnly: true`):**
302
303
 
303
304
  3. **INSERT** - `DECO_COLLECTION_{NAME}_INSERT`
304
305
  - Create a new entity
305
- - Input: `data` (without uri, which is auto-generated)
306
- - Output: `item` (with generated URI)
306
+ - Input: `data` (id may be auto-generated by the server)
307
+ - Output: `item` (with generated id)
307
308
 
308
309
  4. **UPDATE** - `DECO_COLLECTION_{NAME}_UPDATE`
309
310
  - Update an existing entity
310
- - Input: `uri`, `data` (partial)
311
+ - Input: `id` (string), `data` (partial)
311
312
  - Output: `item`
312
313
 
313
314
  5. **DELETE** - `DECO_COLLECTION_{NAME}_DELETE`
314
315
  - Delete an entity
315
- - Input: `uri`
316
- - Output: `success`, `uri`
316
+ - Input: `id` (string)
317
+ - Output: `success` (boolean), `id` (string)
317
318
 
318
319
  ### Read-Only Collections
319
320
 
@@ -332,12 +333,12 @@ This is useful for collections that are managed externally or should not be modi
332
333
 
333
334
  ## Models Bindings
334
335
 
335
- Models bindings provide a well-known interface for AI model providers. They use collection bindings under the hood for LIST and GET operations, and add a streaming endpoint tool.
336
+ Models bindings provide a well-known interface for AI model providers. They use collection bindings under the hood for LIST and GET operations, with streaming endpoint information included directly in each model entity.
336
337
 
337
338
  ### Using Models Bindings
338
339
 
339
340
  ```typescript
340
- import { MODELS_BINDING, MODELS_COLLECTION_BINDING } from "@decocms/bindings/well-known/models";
341
+ import { MODELS_BINDING, MODELS_COLLECTION_BINDING } from "@decocms/bindings/models";
341
342
  import { createBindingChecker } from "@decocms/bindings";
342
343
 
343
344
  // Use the pre-defined MODELS_BINDING
@@ -347,7 +348,6 @@ const modelsChecker = createBindingChecker(MODELS_BINDING);
347
348
  const availableTools = [
348
349
  { name: "DECO_COLLECTION_MODELS_LIST" },
349
350
  { name: "DECO_COLLECTION_MODELS_GET" },
350
- { name: "GET_STREAM_ENDPOINT" },
351
351
  ];
352
352
 
353
353
  const isImplemented = await modelsChecker.isImplementedBy(availableTools);
@@ -359,21 +359,16 @@ console.log(isImplemented); // true if all required tools are present
359
359
  The `MODELS_BINDING` includes:
360
360
 
361
361
  1. **DECO_COLLECTION_MODELS_LIST** (required)
362
- - List available AI models with their capabilities
362
+ - List available AI models with their capabilities and streaming endpoints
363
363
  - Uses collection binding LIST operation
364
364
  - Input: `where?`, `orderBy?`, `limit?`, `offset?`
365
- - Output: `items[]` (array of model entities)
365
+ - Output: `items[]` (array of model entities with endpoint info)
366
366
 
367
367
  2. **DECO_COLLECTION_MODELS_GET** (required)
368
- - Get a single model by URI
368
+ - Get a single model by ID
369
369
  - Uses collection binding GET operation
370
- - Input: `uri`
371
- - Output: `item | null`
372
-
373
- 3. **GET_STREAM_ENDPOINT** (required)
374
- - Get the streaming endpoint URL for chat completions
375
- - Input: `{}` (empty object, passthrough)
376
- - Output: `{ url?: string }` (optional URL)
370
+ - Input: `id` (string)
371
+ - Output: `item | null` (model entity with endpoint info)
377
372
 
378
373
  ### Model Entity Schema
379
374
 
@@ -381,21 +376,29 @@ Models follow the collection entity schema with additional model-specific fields
381
376
 
382
377
  ```typescript
383
378
  {
384
- uri: string; // Collection URI
385
- created_at: string; // Creation timestamp
386
- updated_at: string; // Last update timestamp
387
- created_by?: string; // User who created
388
- updated_by?: string; // User who last updated
389
- id: string; // Model ID
390
- model: string; // Model identifier
391
- name: string; // Display name
392
- logo: string | null; // Logo URL
393
- capabilities: string[]; // Array of capabilities
394
- contextWindow: number | null; // Context window size
395
- inputCost: number | null; // Input cost per token
396
- outputCost: number | null; // Output cost per token
397
- outputLimit: number | null; // Output limit
398
- description: string | null; // Model description
379
+ id: string; // Unique identifier (from base schema)
380
+ title: string; // Display name (from base schema)
381
+ created_at: string; // Creation timestamp
382
+ updated_at: string; // Last update timestamp
383
+ created_by?: string; // User who created
384
+ updated_by?: string; // User who last updated
385
+ logo: string | null; // Logo URL
386
+ description: string | null; // Model description
387
+ capabilities: string[]; // Array of capabilities
388
+ limits: { // Model limits
389
+ contextWindow: number; // Maximum context window size
390
+ maxOutputTokens: number; // Maximum output tokens
391
+ } | null;
392
+ costs: { // Model costs
393
+ input: number; // Cost per input token
394
+ output: number; // Cost per output token
395
+ } | null;
396
+ endpoint: { // Streaming endpoint information
397
+ url: string; // Endpoint URL
398
+ method: string; // HTTP method (default: "POST")
399
+ contentType: string; // Content type (default: "application/json")
400
+ stream: boolean; // Supports streaming (default: true)
401
+ } | null;
399
402
  }
400
403
  ```
401
404
 
@@ -404,8 +407,7 @@ Models follow the collection entity schema with additional model-specific fields
404
407
  Here's how you would implement the models binding in an MCP server:
405
408
 
406
409
  ```typescript
407
- import { MODELS_BINDING } from "@decocms/bindings/well-known/models";
408
- import { parseCollectionUri } from "@decocms/bindings/well-known/collections";
410
+ import { MODELS_BINDING } from "@decocms/bindings/models";
409
411
  import { impl } from "@decocms/sdk/mcp/bindings/binder";
410
412
 
411
413
  const modelTools = impl(MODELS_BINDING, [
@@ -420,26 +422,19 @@ const modelTools = impl(MODELS_BINDING, [
420
422
  skip: offset,
421
423
  });
422
424
 
425
+ // Include endpoint info in each model
423
426
  return { items, hasMore: items.length === limit };
424
427
  },
425
428
  },
426
429
  {
427
- description: "Get a model by URI",
428
- handler: async ({ uri }) => {
429
- const parsed = parseCollectionUri(uri);
430
+ description: "Get a model by ID",
431
+ handler: async ({ id }) => {
430
432
  const item = await db.models.findUnique({
431
- where: { id: parsed.itemId },
433
+ where: { id },
432
434
  });
433
435
  return { item };
434
436
  },
435
437
  },
436
- {
437
- description: "Get streaming endpoint",
438
- handler: async () => {
439
- // Return your streaming endpoint URL
440
- return { url: "https://api.example.com/v1/chat/completions" };
441
- },
442
- },
443
438
  ]);
444
439
  ```
445
440
 
@@ -487,30 +482,6 @@ The `orderBy` parameter supports multi-field sorting:
487
482
  ]
488
483
  ```
489
484
 
490
- ### Collection URI Helpers
491
-
492
- The package provides utility functions for working with collection URIs:
493
-
494
- ```typescript
495
- import {
496
- validateCollectionUri,
497
- parseCollectionUri,
498
- constructCollectionUri,
499
- } from "@decocms/bindings/well-known/collections";
500
-
501
- // Validate a URI
502
- const isValid = validateCollectionUri("rsc://conn-123/users/user-456");
503
- // true
504
-
505
- // Parse a URI into components
506
- const parsed = parseCollectionUri("rsc://conn-123/users/user-456");
507
- // { connectionId: "conn-123", collectionName: "users", itemId: "user-456" }
508
-
509
- // Construct a URI from components
510
- const uri = constructCollectionUri("conn-123", "users", "user-456");
511
- // "rsc://conn-123/users/user-456"
512
- ```
513
-
514
485
  ### TanStack DB Integration
515
486
 
516
487
  Collection bindings are designed to work with TanStack DB's query-collection. The `where` and `orderBy` expressions are compatible with TanStack DB's `LoadSubsetOptions`, allowing for efficient predicate push-down to your backend.
@@ -521,17 +492,16 @@ Here's how you would implement a collection binding in an MCP server:
521
492
 
522
493
  ```typescript
523
494
  import { z } from "zod";
524
- import { createCollectionBindings } from "@decocms/bindings/well-known/collections";
525
- import { parseCollectionUri, constructCollectionUri } from "@decocms/bindings/well-known/collections";
495
+ import { createCollectionBindings } from "@decocms/bindings/collections";
526
496
  import { impl } from "@decocms/sdk/mcp/bindings/binder";
527
497
 
528
498
  const TodoSchema = z.object({
529
- uri: z.string(),
499
+ id: z.string(),
500
+ title: z.string(), // From base schema
530
501
  created_at: z.string().datetime(),
531
502
  updated_at: z.string().datetime(),
532
503
  created_by: z.string().optional(),
533
504
  updated_by: z.string().optional(),
534
- title: z.string(),
535
505
  completed: z.boolean(),
536
506
  userId: z.number(),
537
507
  });
@@ -555,11 +525,10 @@ const todoTools = impl(TODO_COLLECTION_BINDING, [
555
525
  },
556
526
  },
557
527
  {
558
- description: "Get a todo by URI",
559
- handler: async ({ uri }) => {
560
- const parsed = parseCollectionUri(uri);
528
+ description: "Get a todo by ID",
529
+ handler: async ({ id }) => {
561
530
  const item = await db.todos.findUnique({
562
- where: { id: parsed.itemId },
531
+ where: { id },
563
532
  });
564
533
  return { item };
565
534
  },
@@ -567,21 +536,20 @@ const todoTools = impl(TODO_COLLECTION_BINDING, [
567
536
  {
568
537
  description: "Create a new todo",
569
538
  handler: async ({ data }) => {
570
- const item = await db.todos.create({ data });
571
- const uri = constructCollectionUri(
572
- connectionId,
573
- "todos",
574
- item.id
575
- );
576
- return { item: { ...item, uri } };
539
+ const item = await db.todos.create({
540
+ data: {
541
+ ...data,
542
+ id: data.id || generateId(), // Use provided ID or generate one
543
+ }
544
+ });
545
+ return { item };
577
546
  },
578
547
  },
579
548
  {
580
549
  description: "Update a todo",
581
- handler: async ({ uri, data }) => {
582
- const parsed = parseCollectionUri(uri);
550
+ handler: async ({ id, data }) => {
583
551
  const item = await db.todos.update({
584
- where: { id: parsed.itemId },
552
+ where: { id },
585
553
  data,
586
554
  });
587
555
  return { item };
@@ -589,10 +557,9 @@ const todoTools = impl(TODO_COLLECTION_BINDING, [
589
557
  },
590
558
  {
591
559
  description: "Delete a todo",
592
- handler: async ({ uri }) => {
593
- const parsed = parseCollectionUri(uri);
594
- await db.todos.delete({ where: { id: parsed.itemId } });
595
- return { success: true, uri };
560
+ handler: async ({ id }) => {
561
+ await db.todos.delete({ where: { id } });
562
+ return { success: true, id };
596
563
  },
597
564
  },
598
565
  ]);
@@ -0,0 +1,132 @@
1
+ import { z } from 'zod';
2
+
3
+ // src/well-known/collections.ts
4
+ var BaseCollectionEntitySchema = z.object({
5
+ id: z.string().describe("Unique identifier for the entity"),
6
+ title: z.string().describe("Human-readable title for the entity"),
7
+ created_at: z.string().datetime(),
8
+ updated_at: z.string().datetime(),
9
+ created_by: z.string().optional(),
10
+ updated_by: z.string().optional()
11
+ });
12
+ var WhereExpressionSchema = z.lazy(
13
+ () => z.union([
14
+ // Simple comparison
15
+ z.object({
16
+ field: z.array(z.string()),
17
+ operator: z.enum([
18
+ "eq",
19
+ "gt",
20
+ "gte",
21
+ "lt",
22
+ "lte",
23
+ "in",
24
+ "like",
25
+ "contains"
26
+ ]),
27
+ value: z.unknown()
28
+ }),
29
+ // Logical operators
30
+ z.object({
31
+ operator: z.enum(["and", "or", "not"]),
32
+ conditions: z.array(WhereExpressionSchema)
33
+ })
34
+ ])
35
+ );
36
+ var OrderByExpressionSchema = z.object({
37
+ field: z.array(z.string()),
38
+ direction: z.enum(["asc", "desc"]),
39
+ nulls: z.enum(["first", "last"]).optional()
40
+ });
41
+ var CollectionListInputSchema = z.object({
42
+ where: WhereExpressionSchema.optional().describe("Filter expression"),
43
+ orderBy: z.array(OrderByExpressionSchema).optional().describe("Sort expressions"),
44
+ limit: z.number().int().min(1).max(1e3).optional().describe("Maximum number of items to return"),
45
+ offset: z.number().int().min(0).optional().describe("Number of items to skip")
46
+ });
47
+ function createCollectionListOutputSchema(entitySchema) {
48
+ return z.object({
49
+ items: z.array(entitySchema).describe("Array of collection items"),
50
+ totalCount: z.number().int().min(0).optional().describe("Total number of matching items (if available)"),
51
+ hasMore: z.boolean().optional().describe("Whether there are more items available")
52
+ });
53
+ }
54
+ var CollectionGetInputSchema = z.object({
55
+ id: z.string().describe("ID of the entity to retrieve")
56
+ });
57
+ function createCollectionGetOutputSchema(entitySchema) {
58
+ return z.object({
59
+ item: entitySchema.nullable().describe("The retrieved item, or null if not found")
60
+ });
61
+ }
62
+ function createCollectionInsertInputSchema(entitySchema) {
63
+ return z.object({
64
+ data: entitySchema.describe("Data for the new entity (id may be auto-generated)")
65
+ });
66
+ }
67
+ function createCollectionInsertOutputSchema(entitySchema) {
68
+ return z.object({
69
+ item: entitySchema.describe("The created entity with generated id")
70
+ });
71
+ }
72
+ function createCollectionUpdateInputSchema(entitySchema) {
73
+ return z.object({
74
+ id: z.string().describe("ID of the entity to update"),
75
+ data: entitySchema.partial().describe("Partial entity data to update")
76
+ });
77
+ }
78
+ function createCollectionUpdateOutputSchema(entitySchema) {
79
+ return z.object({
80
+ item: entitySchema.describe("The updated entity")
81
+ });
82
+ }
83
+ var CollectionDeleteInputSchema = z.object({
84
+ id: z.string().describe("ID of the entity to delete")
85
+ });
86
+ var CollectionDeleteOutputSchema = z.object({
87
+ success: z.boolean().describe("Whether the deletion was successful"),
88
+ id: z.string().describe("ID of the deleted entity")
89
+ });
90
+ function createCollectionBindings(collectionName, entitySchema, options) {
91
+ const upperName = collectionName.toUpperCase();
92
+ const readOnly = options?.readOnly ?? false;
93
+ const bindings = [
94
+ {
95
+ name: `DECO_COLLECTION_${upperName}_LIST`,
96
+ inputSchema: CollectionListInputSchema,
97
+ outputSchema: createCollectionListOutputSchema(entitySchema)
98
+ },
99
+ {
100
+ name: `DECO_COLLECTION_${upperName}_GET`,
101
+ inputSchema: CollectionGetInputSchema,
102
+ outputSchema: createCollectionGetOutputSchema(entitySchema)
103
+ }
104
+ ];
105
+ if (!readOnly) {
106
+ bindings.push(
107
+ {
108
+ name: `DECO_COLLECTION_${upperName}_INSERT`,
109
+ inputSchema: createCollectionInsertInputSchema(entitySchema),
110
+ outputSchema: createCollectionInsertOutputSchema(entitySchema),
111
+ opt: true
112
+ },
113
+ {
114
+ name: `DECO_COLLECTION_${upperName}_UPDATE`,
115
+ inputSchema: createCollectionUpdateInputSchema(entitySchema),
116
+ outputSchema: createCollectionUpdateOutputSchema(entitySchema),
117
+ opt: true
118
+ },
119
+ {
120
+ name: `DECO_COLLECTION_${upperName}_DELETE`,
121
+ inputSchema: CollectionDeleteInputSchema,
122
+ outputSchema: CollectionDeleteOutputSchema,
123
+ opt: true
124
+ }
125
+ );
126
+ }
127
+ return bindings;
128
+ }
129
+
130
+ export { BaseCollectionEntitySchema, CollectionDeleteInputSchema, CollectionDeleteOutputSchema, CollectionGetInputSchema, CollectionListInputSchema, OrderByExpressionSchema, WhereExpressionSchema, createCollectionBindings, createCollectionGetOutputSchema, createCollectionInsertInputSchema, createCollectionInsertOutputSchema, createCollectionListOutputSchema, createCollectionUpdateInputSchema, createCollectionUpdateOutputSchema };
131
+ //# sourceMappingURL=chunk-IBOJHI67.js.map
132
+ //# sourceMappingURL=chunk-IBOJHI67.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/well-known/collections.ts"],"names":[],"mappings":"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","file":"chunk-IBOJHI67.js","sourcesContent":["import { z } from \"zod\";\nimport type { ToolBinder } from \"../core/binder\";\n\n/**\n * Collection Bindings\n *\n * This module provides standardized tool bindings for Collections, representing\n * SQL table-like structures with CRUD + Search operations compatible with TanStack DB.\n *\n * Key Features:\n * - Generic collection bindings that work with any entity type\n * - Standardized tool naming: `DECO_COLLECTION_{COLLECTION}_*`\n * - Compatible with TanStack DB query-collection\n * - Full TypeScript support with proper type constraints\n * - Support for filtering, sorting, and pagination\n * - Simple id and title fields for human-readable identification\n */\n\n/**\n * Base schema for collection entities\n * All collection entities must have an id, title, and audit trail fields\n */\nexport const BaseCollectionEntitySchema = z.object({\n id: z.string().describe(\"Unique identifier for the entity\"),\n title: z.string().describe(\"Human-readable title for the entity\"),\n created_at: z.string().datetime(),\n updated_at: z.string().datetime(),\n created_by: z.string().optional(),\n updated_by: z.string().optional(),\n});\n\n/**\n * Type helper for BaseCollectionEntitySchema\n */\nexport type BaseCollectionEntitySchemaType = typeof BaseCollectionEntitySchema;\n\n/**\n * Where expression type for filtering\n * Supports TanStack DB predicate push-down patterns\n */\nexport type WhereExpression =\n | {\n field: string[];\n operator: \"eq\" | \"gt\" | \"gte\" | \"lt\" | \"lte\" | \"in\" | \"like\" | \"contains\";\n value: unknown;\n }\n | {\n operator: \"and\" | \"or\" | \"not\";\n conditions: WhereExpression[];\n };\n\n/**\n * Where expression schema for filtering\n * Supports TanStack DB predicate push-down patterns\n */\nexport const WhereExpressionSchema = z.lazy(() =>\n z.union([\n // Simple comparison\n z.object({\n field: z.array(z.string()),\n operator: z.enum([\n \"eq\",\n \"gt\",\n \"gte\",\n \"lt\",\n \"lte\",\n \"in\",\n \"like\",\n \"contains\",\n ]),\n value: z.unknown(),\n }),\n // Logical operators\n z.object({\n operator: z.enum([\"and\", \"or\", \"not\"]),\n conditions: z.array(WhereExpressionSchema),\n }),\n ])\n) as z.ZodType<WhereExpression>;\n\n/**\n * Order by expression for sorting\n */\nexport const OrderByExpressionSchema = z.object({\n field: z.array(z.string()),\n direction: z.enum([\"asc\", \"desc\"]),\n nulls: z.enum([\"first\", \"last\"]).optional(),\n});\n\n/**\n * List/Query input schema for collections\n * Compatible with TanStack DB LoadSubsetOptions\n */\nexport const CollectionListInputSchema = z.object({\n where: WhereExpressionSchema.optional().describe(\"Filter expression\"),\n orderBy: z\n .array(OrderByExpressionSchema)\n .optional()\n .describe(\"Sort expressions\"),\n limit: z\n .number()\n .int()\n .min(1)\n .max(1000)\n .optional()\n .describe(\"Maximum number of items to return\"),\n offset: z\n .number()\n .int()\n .min(0)\n .optional()\n .describe(\"Number of items to skip\"),\n});\n\n/**\n * Factory function to create list output schema for a specific collection type\n */\nexport function createCollectionListOutputSchema<T extends z.ZodTypeAny>(\n entitySchema: T,\n) {\n return z.object({\n items: z.array(entitySchema).describe(\"Array of collection items\"),\n totalCount: z\n .number()\n .int()\n .min(0)\n .optional()\n .describe(\"Total number of matching items (if available)\"),\n hasMore: z\n .boolean()\n .optional()\n .describe(\"Whether there are more items available\"),\n });\n}\n\n/**\n * Get by ID input schema\n */\nexport const CollectionGetInputSchema = z.object({\n id: z.string().describe(\"ID of the entity to retrieve\"),\n});\n\n/**\n * Factory function to create get output schema\n */\nexport function createCollectionGetOutputSchema<T extends z.ZodTypeAny>(\n entitySchema: T,\n) {\n return z.object({\n item: entitySchema\n .nullable()\n .describe(\"The retrieved item, or null if not found\"),\n });\n}\n\n/**\n * Factory function to create insert input schema\n */\nexport function createCollectionInsertInputSchema<T extends z.ZodTypeAny>(\n entitySchema: T,\n) {\n // Remove id field since it may be auto-generated by the server\n return z.object({\n data: entitySchema.describe(\"Data for the new entity (id may be auto-generated)\"),\n });\n}\n\n/**\n * Factory function to create insert output schema\n */\nexport function createCollectionInsertOutputSchema<T extends z.ZodTypeAny>(\n entitySchema: T,\n) {\n return z.object({\n item: entitySchema.describe(\"The created entity with generated id\"),\n });\n}\n\n/**\n * Factory function to create update input schema\n */\nexport function createCollectionUpdateInputSchema<T extends z.ZodTypeAny>(\n entitySchema: T,\n) {\n return z.object({\n id: z.string().describe(\"ID of the entity to update\"),\n data: (entitySchema as unknown as z.AnyZodObject)\n .partial()\n .describe(\"Partial entity data to update\"),\n });\n}\n\n/**\n * Factory function to create update output schema\n */\nexport function createCollectionUpdateOutputSchema<T extends z.ZodTypeAny>(\n entitySchema: T,\n) {\n return z.object({\n item: entitySchema.describe(\"The updated entity\"),\n });\n}\n\n/**\n * Delete input schema\n */\nexport const CollectionDeleteInputSchema = z.object({\n id: z.string().describe(\"ID of the entity to delete\"),\n});\n\n/**\n * Delete output schema\n */\nexport const CollectionDeleteOutputSchema = z.object({\n success: z.boolean().describe(\"Whether the deletion was successful\"),\n id: z.string().describe(\"ID of the deleted entity\"),\n});\n\n/**\n * Options for creating collection bindings\n */\nexport interface CollectionBindingOptions {\n /**\n * If true, only LIST and GET operations will be included (read-only collection)\n * @default false\n */\n readOnly?: boolean;\n}\n\n/**\n * Creates generic collection bindings for a specific entity type\n *\n * This function generates standardized tool bindings that work with any collection/table\n * by accepting a custom entity schema and collection name. The bindings provide:\n * - DECO_COLLECTION_{NAME}_LIST - Query/search entities with filtering and sorting (required)\n * - DECO_COLLECTION_{NAME}_GET - Get a single entity by ID (required)\n * - DECO_COLLECTION_{NAME}_INSERT - Create a new entity (optional, excluded if readOnly=true)\n * - DECO_COLLECTION_{NAME}_UPDATE - Update an existing entity (optional, excluded if readOnly=true)\n * - DECO_COLLECTION_{NAME}_DELETE - Delete an entity (optional, excluded if readOnly=true)\n *\n * @param collectionName - The name of the collection/table (e.g., \"users\", \"products\", \"orders\")\n * @param entitySchema - The Zod schema for the entity type (must extend BaseCollectionEntitySchema)\n * @param options - Optional configuration for the collection bindings\n * @returns Array of tool bindings for Collection CRUD + Query operations\n *\n * @example\n * ```typescript\n * const UserSchema = z.object({\n * id: z.string(),\n * title: z.string(),\n * created_at: z.string().datetime(),\n * updated_at: z.string().datetime(),\n * created_by: z.string().optional(),\n * updated_by: z.string().optional(),\n * email: z.string().email(),\n * });\n *\n * // Full CRUD collection\n * const USER_COLLECTION_BINDING = createCollectionBindings(\"users\", UserSchema);\n *\n * // Read-only collection (only LIST and GET)\n * const READONLY_COLLECTION_BINDING = createCollectionBindings(\"products\", ProductSchema, { readOnly: true });\n * ```\n */\nexport function createCollectionBindings<\n TEntitySchema extends BaseCollectionEntitySchemaType,\n>(\n collectionName: string,\n entitySchema: TEntitySchema,\n options?: CollectionBindingOptions,\n) {\n const upperName = collectionName.toUpperCase();\n const readOnly = options?.readOnly ?? false;\n\n const bindings: ToolBinder[] = [\n {\n name: `DECO_COLLECTION_${upperName}_LIST` as const,\n inputSchema: CollectionListInputSchema,\n outputSchema: createCollectionListOutputSchema(entitySchema),\n },\n {\n name: `DECO_COLLECTION_${upperName}_GET` as const,\n inputSchema: CollectionGetInputSchema,\n outputSchema: createCollectionGetOutputSchema(entitySchema),\n },\n ];\n\n // Only include mutation operations if not read-only\n if (!readOnly) {\n bindings.push(\n {\n name: `DECO_COLLECTION_${upperName}_INSERT` as const,\n inputSchema: createCollectionInsertInputSchema(entitySchema),\n outputSchema: createCollectionInsertOutputSchema(entitySchema),\n opt: true,\n },\n {\n name: `DECO_COLLECTION_${upperName}_UPDATE` as const,\n inputSchema: createCollectionUpdateInputSchema(entitySchema),\n outputSchema: createCollectionUpdateOutputSchema(entitySchema),\n opt: true,\n },\n {\n name: `DECO_COLLECTION_${upperName}_DELETE` as const,\n inputSchema: CollectionDeleteInputSchema,\n outputSchema: CollectionDeleteOutputSchema,\n opt: true,\n },\n );\n }\n\n return bindings satisfies readonly ToolBinder[];\n}\n\n/**\n * Type helper to extract the collection binding type\n */\nexport type CollectionBinding<\n TEntitySchema extends BaseCollectionEntitySchemaType,\n> = ReturnType<typeof createCollectionBindings<TEntitySchema>>;\n\n/**\n * Type helper to extract tool names from a collection binding\n */\nexport type CollectionTools<\n TEntitySchema extends BaseCollectionEntitySchemaType,\n> = CollectionBinding<TEntitySchema>[number][\"name\"];\n\n// Export types for TypeScript usage\nexport type CollectionListInput = z.infer<typeof CollectionListInputSchema>;\nexport type CollectionGetInput = z.infer<typeof CollectionGetInputSchema>;\nexport type CollectionDeleteInput = z.infer<typeof CollectionDeleteInputSchema>;\nexport type CollectionDeleteOutput = z.infer<\n typeof CollectionDeleteOutputSchema\n>;\nexport type OrderByExpression = z.infer<typeof OrderByExpressionSchema>;\n"]}
@@ -0,0 +1,293 @@
1
+ import { z } from 'zod';
2
+ import { ToolBinder } from '../index.js';
3
+
4
+ /**
5
+ * Collection Bindings
6
+ *
7
+ * This module provides standardized tool bindings for Collections, representing
8
+ * SQL table-like structures with CRUD + Search operations compatible with TanStack DB.
9
+ *
10
+ * Key Features:
11
+ * - Generic collection bindings that work with any entity type
12
+ * - Standardized tool naming: `DECO_COLLECTION_{COLLECTION}_*`
13
+ * - Compatible with TanStack DB query-collection
14
+ * - Full TypeScript support with proper type constraints
15
+ * - Support for filtering, sorting, and pagination
16
+ * - Simple id and title fields for human-readable identification
17
+ */
18
+ /**
19
+ * Base schema for collection entities
20
+ * All collection entities must have an id, title, and audit trail fields
21
+ */
22
+ declare const BaseCollectionEntitySchema: z.ZodObject<{
23
+ id: z.ZodString;
24
+ title: z.ZodString;
25
+ created_at: z.ZodString;
26
+ updated_at: z.ZodString;
27
+ created_by: z.ZodOptional<z.ZodString>;
28
+ updated_by: z.ZodOptional<z.ZodString>;
29
+ }, "strip", z.ZodTypeAny, {
30
+ id: string;
31
+ title: string;
32
+ created_at: string;
33
+ updated_at: string;
34
+ created_by?: string | undefined;
35
+ updated_by?: string | undefined;
36
+ }, {
37
+ id: string;
38
+ title: string;
39
+ created_at: string;
40
+ updated_at: string;
41
+ created_by?: string | undefined;
42
+ updated_by?: string | undefined;
43
+ }>;
44
+ /**
45
+ * Type helper for BaseCollectionEntitySchema
46
+ */
47
+ type BaseCollectionEntitySchemaType = typeof BaseCollectionEntitySchema;
48
+ /**
49
+ * Where expression type for filtering
50
+ * Supports TanStack DB predicate push-down patterns
51
+ */
52
+ type WhereExpression = {
53
+ field: string[];
54
+ operator: "eq" | "gt" | "gte" | "lt" | "lte" | "in" | "like" | "contains";
55
+ value: unknown;
56
+ } | {
57
+ operator: "and" | "or" | "not";
58
+ conditions: WhereExpression[];
59
+ };
60
+ /**
61
+ * Where expression schema for filtering
62
+ * Supports TanStack DB predicate push-down patterns
63
+ */
64
+ declare const WhereExpressionSchema: z.ZodType<WhereExpression>;
65
+ /**
66
+ * Order by expression for sorting
67
+ */
68
+ declare const OrderByExpressionSchema: z.ZodObject<{
69
+ field: z.ZodArray<z.ZodString, "many">;
70
+ direction: z.ZodEnum<["asc", "desc"]>;
71
+ nulls: z.ZodOptional<z.ZodEnum<["first", "last"]>>;
72
+ }, "strip", z.ZodTypeAny, {
73
+ field: string[];
74
+ direction: "asc" | "desc";
75
+ nulls?: "first" | "last" | undefined;
76
+ }, {
77
+ field: string[];
78
+ direction: "asc" | "desc";
79
+ nulls?: "first" | "last" | undefined;
80
+ }>;
81
+ /**
82
+ * List/Query input schema for collections
83
+ * Compatible with TanStack DB LoadSubsetOptions
84
+ */
85
+ declare const CollectionListInputSchema: z.ZodObject<{
86
+ where: z.ZodOptional<z.ZodType<WhereExpression, z.ZodTypeDef, WhereExpression>>;
87
+ orderBy: z.ZodOptional<z.ZodArray<z.ZodObject<{
88
+ field: z.ZodArray<z.ZodString, "many">;
89
+ direction: z.ZodEnum<["asc", "desc"]>;
90
+ nulls: z.ZodOptional<z.ZodEnum<["first", "last"]>>;
91
+ }, "strip", z.ZodTypeAny, {
92
+ field: string[];
93
+ direction: "asc" | "desc";
94
+ nulls?: "first" | "last" | undefined;
95
+ }, {
96
+ field: string[];
97
+ direction: "asc" | "desc";
98
+ nulls?: "first" | "last" | undefined;
99
+ }>, "many">>;
100
+ limit: z.ZodOptional<z.ZodNumber>;
101
+ offset: z.ZodOptional<z.ZodNumber>;
102
+ }, "strip", z.ZodTypeAny, {
103
+ where?: WhereExpression | undefined;
104
+ orderBy?: {
105
+ field: string[];
106
+ direction: "asc" | "desc";
107
+ nulls?: "first" | "last" | undefined;
108
+ }[] | undefined;
109
+ limit?: number | undefined;
110
+ offset?: number | undefined;
111
+ }, {
112
+ where?: WhereExpression | undefined;
113
+ orderBy?: {
114
+ field: string[];
115
+ direction: "asc" | "desc";
116
+ nulls?: "first" | "last" | undefined;
117
+ }[] | undefined;
118
+ limit?: number | undefined;
119
+ offset?: number | undefined;
120
+ }>;
121
+ /**
122
+ * Factory function to create list output schema for a specific collection type
123
+ */
124
+ declare function createCollectionListOutputSchema<T extends z.ZodTypeAny>(entitySchema: T): z.ZodObject<{
125
+ items: z.ZodArray<T, "many">;
126
+ totalCount: z.ZodOptional<z.ZodNumber>;
127
+ hasMore: z.ZodOptional<z.ZodBoolean>;
128
+ }, "strip", z.ZodTypeAny, {
129
+ items: T["_output"][];
130
+ totalCount?: number | undefined;
131
+ hasMore?: boolean | undefined;
132
+ }, {
133
+ items: T["_input"][];
134
+ totalCount?: number | undefined;
135
+ hasMore?: boolean | undefined;
136
+ }>;
137
+ /**
138
+ * Get by ID input schema
139
+ */
140
+ declare const CollectionGetInputSchema: z.ZodObject<{
141
+ id: z.ZodString;
142
+ }, "strip", z.ZodTypeAny, {
143
+ id: string;
144
+ }, {
145
+ id: string;
146
+ }>;
147
+ /**
148
+ * Factory function to create get output schema
149
+ */
150
+ declare function createCollectionGetOutputSchema<T extends z.ZodTypeAny>(entitySchema: T): z.ZodObject<{
151
+ item: z.ZodNullable<T>;
152
+ }, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
153
+ item: z.ZodNullable<T>;
154
+ }>, any> extends infer T_1 ? { [k in keyof T_1]: T_1[k]; } : never, z.baseObjectInputType<{
155
+ item: z.ZodNullable<T>;
156
+ }> extends infer T_2 ? { [k_1 in keyof T_2]: T_2[k_1]; } : never>;
157
+ /**
158
+ * Factory function to create insert input schema
159
+ */
160
+ declare function createCollectionInsertInputSchema<T extends z.ZodTypeAny>(entitySchema: T): z.ZodObject<{
161
+ data: T;
162
+ }, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
163
+ data: T;
164
+ }>, any> extends infer T_1 ? { [k in keyof T_1]: T_1[k]; } : never, z.baseObjectInputType<{
165
+ data: T;
166
+ }> extends infer T_2 ? { [k_1 in keyof T_2]: T_2[k_1]; } : never>;
167
+ /**
168
+ * Factory function to create insert output schema
169
+ */
170
+ declare function createCollectionInsertOutputSchema<T extends z.ZodTypeAny>(entitySchema: T): z.ZodObject<{
171
+ item: T;
172
+ }, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
173
+ item: T;
174
+ }>, any> extends infer T_1 ? { [k in keyof T_1]: T_1[k]; } : never, z.baseObjectInputType<{
175
+ item: T;
176
+ }> extends infer T_2 ? { [k_1 in keyof T_2]: T_2[k_1]; } : never>;
177
+ /**
178
+ * Factory function to create update input schema
179
+ */
180
+ declare function createCollectionUpdateInputSchema<T extends z.ZodTypeAny>(entitySchema: T): z.ZodObject<{
181
+ id: z.ZodString;
182
+ data: z.ZodObject<{
183
+ [x: string]: z.ZodOptional<any>;
184
+ }, any, any, {
185
+ [x: string]: any;
186
+ }, {
187
+ [x: string]: any;
188
+ }>;
189
+ }, "strip", z.ZodTypeAny, {
190
+ id: string;
191
+ data: {
192
+ [x: string]: any;
193
+ };
194
+ }, {
195
+ id: string;
196
+ data: {
197
+ [x: string]: any;
198
+ };
199
+ }>;
200
+ /**
201
+ * Factory function to create update output schema
202
+ */
203
+ declare function createCollectionUpdateOutputSchema<T extends z.ZodTypeAny>(entitySchema: T): z.ZodObject<{
204
+ item: T;
205
+ }, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
206
+ item: T;
207
+ }>, any> extends infer T_1 ? { [k in keyof T_1]: T_1[k]; } : never, z.baseObjectInputType<{
208
+ item: T;
209
+ }> extends infer T_2 ? { [k_1 in keyof T_2]: T_2[k_1]; } : never>;
210
+ /**
211
+ * Delete input schema
212
+ */
213
+ declare const CollectionDeleteInputSchema: z.ZodObject<{
214
+ id: z.ZodString;
215
+ }, "strip", z.ZodTypeAny, {
216
+ id: string;
217
+ }, {
218
+ id: string;
219
+ }>;
220
+ /**
221
+ * Delete output schema
222
+ */
223
+ declare const CollectionDeleteOutputSchema: z.ZodObject<{
224
+ success: z.ZodBoolean;
225
+ id: z.ZodString;
226
+ }, "strip", z.ZodTypeAny, {
227
+ id: string;
228
+ success: boolean;
229
+ }, {
230
+ id: string;
231
+ success: boolean;
232
+ }>;
233
+ /**
234
+ * Options for creating collection bindings
235
+ */
236
+ interface CollectionBindingOptions {
237
+ /**
238
+ * If true, only LIST and GET operations will be included (read-only collection)
239
+ * @default false
240
+ */
241
+ readOnly?: boolean;
242
+ }
243
+ /**
244
+ * Creates generic collection bindings for a specific entity type
245
+ *
246
+ * This function generates standardized tool bindings that work with any collection/table
247
+ * by accepting a custom entity schema and collection name. The bindings provide:
248
+ * - DECO_COLLECTION_{NAME}_LIST - Query/search entities with filtering and sorting (required)
249
+ * - DECO_COLLECTION_{NAME}_GET - Get a single entity by ID (required)
250
+ * - DECO_COLLECTION_{NAME}_INSERT - Create a new entity (optional, excluded if readOnly=true)
251
+ * - DECO_COLLECTION_{NAME}_UPDATE - Update an existing entity (optional, excluded if readOnly=true)
252
+ * - DECO_COLLECTION_{NAME}_DELETE - Delete an entity (optional, excluded if readOnly=true)
253
+ *
254
+ * @param collectionName - The name of the collection/table (e.g., "users", "products", "orders")
255
+ * @param entitySchema - The Zod schema for the entity type (must extend BaseCollectionEntitySchema)
256
+ * @param options - Optional configuration for the collection bindings
257
+ * @returns Array of tool bindings for Collection CRUD + Query operations
258
+ *
259
+ * @example
260
+ * ```typescript
261
+ * const UserSchema = z.object({
262
+ * id: z.string(),
263
+ * title: z.string(),
264
+ * created_at: z.string().datetime(),
265
+ * updated_at: z.string().datetime(),
266
+ * created_by: z.string().optional(),
267
+ * updated_by: z.string().optional(),
268
+ * email: z.string().email(),
269
+ * });
270
+ *
271
+ * // Full CRUD collection
272
+ * const USER_COLLECTION_BINDING = createCollectionBindings("users", UserSchema);
273
+ *
274
+ * // Read-only collection (only LIST and GET)
275
+ * const READONLY_COLLECTION_BINDING = createCollectionBindings("products", ProductSchema, { readOnly: true });
276
+ * ```
277
+ */
278
+ declare function createCollectionBindings<TEntitySchema extends BaseCollectionEntitySchemaType>(collectionName: string, entitySchema: TEntitySchema, options?: CollectionBindingOptions): ToolBinder<string, any, object>[];
279
+ /**
280
+ * Type helper to extract the collection binding type
281
+ */
282
+ type CollectionBinding<TEntitySchema extends BaseCollectionEntitySchemaType> = ReturnType<typeof createCollectionBindings<TEntitySchema>>;
283
+ /**
284
+ * Type helper to extract tool names from a collection binding
285
+ */
286
+ type CollectionTools<TEntitySchema extends BaseCollectionEntitySchemaType> = CollectionBinding<TEntitySchema>[number]["name"];
287
+ type CollectionListInput = z.infer<typeof CollectionListInputSchema>;
288
+ type CollectionGetInput = z.infer<typeof CollectionGetInputSchema>;
289
+ type CollectionDeleteInput = z.infer<typeof CollectionDeleteInputSchema>;
290
+ type CollectionDeleteOutput = z.infer<typeof CollectionDeleteOutputSchema>;
291
+ type OrderByExpression = z.infer<typeof OrderByExpressionSchema>;
292
+
293
+ export { BaseCollectionEntitySchema, type BaseCollectionEntitySchemaType, type CollectionBinding, type CollectionBindingOptions, type CollectionDeleteInput, CollectionDeleteInputSchema, type CollectionDeleteOutput, CollectionDeleteOutputSchema, type CollectionGetInput, CollectionGetInputSchema, type CollectionListInput, CollectionListInputSchema, type CollectionTools, type OrderByExpression, OrderByExpressionSchema, type WhereExpression, WhereExpressionSchema, createCollectionBindings, createCollectionGetOutputSchema, createCollectionInsertInputSchema, createCollectionInsertOutputSchema, createCollectionListOutputSchema, createCollectionUpdateInputSchema, createCollectionUpdateOutputSchema };
@@ -0,0 +1,3 @@
1
+ export { BaseCollectionEntitySchema, CollectionDeleteInputSchema, CollectionDeleteOutputSchema, CollectionGetInputSchema, CollectionListInputSchema, OrderByExpressionSchema, WhereExpressionSchema, createCollectionBindings, createCollectionGetOutputSchema, createCollectionInsertInputSchema, createCollectionInsertOutputSchema, createCollectionListOutputSchema, createCollectionUpdateInputSchema, createCollectionUpdateOutputSchema } from '../chunk-IBOJHI67.js';
2
+ //# sourceMappingURL=collections.js.map
3
+ //# sourceMappingURL=collections.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"collections.js"}
@@ -0,0 +1,32 @@
1
+ import { ToolBinder } from '../index.js';
2
+ import 'zod';
3
+
4
+ /**
5
+ * Models Well-Known Binding
6
+ *
7
+ * Defines the interface for AI model providers.
8
+ * Any MCP that implements this binding can provide AI models and streaming endpoints.
9
+ *
10
+ * This binding uses collection bindings for LIST and GET operations (read-only).
11
+ * Streaming endpoint information is included directly in the model entity schema.
12
+ */
13
+ /**
14
+ * MODELS Collection Binding
15
+ *
16
+ * Collection bindings for models (read-only).
17
+ * Provides LIST and GET operations for AI models.
18
+ */
19
+ declare const MODELS_COLLECTION_BINDING: ToolBinder<string, any, object>[];
20
+ /**
21
+ * MODELS Binding
22
+ *
23
+ * Defines the interface for AI model providers.
24
+ * Any MCP that implements this binding can provide AI models and streaming endpoints.
25
+ *
26
+ * Required tools:
27
+ * - DECO_COLLECTION_MODELS_LIST: List available AI models with their capabilities
28
+ * - DECO_COLLECTION_MODELS_GET: Get a single model by ID (includes streaming endpoint info)
29
+ */
30
+ declare const MODELS_BINDING: readonly ToolBinder<string, any, object>[];
31
+
32
+ export { MODELS_BINDING, MODELS_COLLECTION_BINDING };
@@ -0,0 +1,36 @@
1
+ import { BaseCollectionEntitySchema, createCollectionBindings } from '../chunk-IBOJHI67.js';
2
+ import { z } from 'zod';
3
+
4
+ var ModelSchema = BaseCollectionEntitySchema.extend({
5
+ // Model-specific fields
6
+ logo: z.string().nullable(),
7
+ description: z.string().nullable(),
8
+ capabilities: z.array(z.string()),
9
+ limits: z.object({
10
+ contextWindow: z.number(),
11
+ maxOutputTokens: z.number()
12
+ }).nullable(),
13
+ costs: z.object({
14
+ input: z.number(),
15
+ output: z.number()
16
+ }).nullable(),
17
+ // Streaming endpoint information
18
+ endpoint: z.object({
19
+ url: z.string().url(),
20
+ method: z.string().default("POST"),
21
+ contentType: z.string().default("application/json"),
22
+ stream: z.boolean().default(true)
23
+ }).nullable()
24
+ });
25
+ var MODELS_COLLECTION_BINDING = createCollectionBindings(
26
+ "models",
27
+ ModelSchema,
28
+ { readOnly: true }
29
+ );
30
+ var MODELS_BINDING = [
31
+ ...MODELS_COLLECTION_BINDING
32
+ ];
33
+
34
+ export { MODELS_BINDING, MODELS_COLLECTION_BINDING };
35
+ //# sourceMappingURL=models.js.map
36
+ //# sourceMappingURL=models.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/well-known/models.ts"],"names":[],"mappings":";;;AAsBA,IAAM,WAAA,GAAc,2BAA2B,MAAA,CAAO;AAAA;AAAA,EAEpD,IAAA,EAAM,CAAA,CAAE,MAAA,EAAO,CAAE,QAAA,EAAS;AAAA,EAC1B,WAAA,EAAa,CAAA,CAAE,MAAA,EAAO,CAAE,QAAA,EAAS;AAAA,EACjC,YAAA,EAAc,CAAA,CAAE,KAAA,CAAM,CAAA,CAAE,QAAQ,CAAA;AAAA,EAChC,MAAA,EAAQ,EAAE,MAAA,CAAO;AAAA,IACf,aAAA,EAAe,EAAE,MAAA,EAAO;AAAA,IACxB,eAAA,EAAiB,EAAE,MAAA;AAAO,GAC3B,EAAE,QAAA,EAAS;AAAA,EACZ,KAAA,EAAO,EAAE,MAAA,CAAO;AAAA,IACd,KAAA,EAAO,EAAE,MAAA,EAAO;AAAA,IAChB,MAAA,EAAQ,EAAE,MAAA;AAAO,GAClB,EAAE,QAAA,EAAS;AAAA;AAAA,EAEZ,QAAA,EAAU,EAAE,MAAA,CAAO;AAAA,IACjB,GAAA,EAAK,CAAA,CAAE,MAAA,EAAO,CAAE,GAAA,EAAI;AAAA,IACpB,MAAA,EAAQ,CAAA,CAAE,MAAA,EAAO,CAAE,QAAQ,MAAM,CAAA;AAAA,IACjC,WAAA,EAAa,CAAA,CAAE,MAAA,EAAO,CAAE,QAAQ,kBAAkB,CAAA;AAAA,IAClD,MAAA,EAAQ,CAAA,CAAE,OAAA,EAAQ,CAAE,QAAQ,IAAI;AAAA,GACjC,EAAE,QAAA;AACL,CAAC,CAAA;AAQM,IAAM,yBAAA,GAA4B,wBAAA;AAAA,EACvC,QAAA;AAAA,EACA,WAAA;AAAA,EACA,EAAE,UAAU,IAAA;AACd;AAYO,IAAM,cAAA,GAAiB;AAAA,EAC5B,GAAG;AACL","file":"models.js","sourcesContent":["/**\n * Models Well-Known Binding\n *\n * Defines the interface for AI model providers.\n * Any MCP that implements this binding can provide AI models and streaming endpoints.\n *\n * This binding uses collection bindings for LIST and GET operations (read-only).\n * Streaming endpoint information is included directly in the model entity schema.\n */\n\nimport { z } from \"zod\";\nimport type { Binder } from \"../core/binder\";\nimport {\n BaseCollectionEntitySchema,\n createCollectionBindings,\n} from \"./collections\";\n\n/**\n * Model entity schema for AI models\n * Extends BaseCollectionEntitySchema with model-specific fields\n * Base schema already includes: id, title, created_at, updated_at, created_by, updated_by\n */\nconst ModelSchema = BaseCollectionEntitySchema.extend({\n // Model-specific fields\n logo: z.string().nullable(),\n description: z.string().nullable(),\n capabilities: z.array(z.string()),\n limits: z.object({\n contextWindow: z.number(),\n maxOutputTokens: z.number(),\n }).nullable(),\n costs: z.object({\n input: z.number(),\n output: z.number(),\n }).nullable(),\n // Streaming endpoint information\n endpoint: z.object({\n url: z.string().url(),\n method: z.string().default(\"POST\"),\n contentType: z.string().default(\"application/json\"),\n stream: z.boolean().default(true),\n }).nullable(),\n});\n\n/**\n * MODELS Collection Binding\n *\n * Collection bindings for models (read-only).\n * Provides LIST and GET operations for AI models.\n */\nexport const MODELS_COLLECTION_BINDING = createCollectionBindings(\n \"models\",\n ModelSchema,\n { readOnly: true },\n);\n\n/**\n * MODELS Binding\n *\n * Defines the interface for AI model providers.\n * Any MCP that implements this binding can provide AI models and streaming endpoints.\n *\n * Required tools:\n * - DECO_COLLECTION_MODELS_LIST: List available AI models with their capabilities\n * - DECO_COLLECTION_MODELS_GET: Get a single model by ID (includes streaming endpoint info)\n */\nexport const MODELS_BINDING = [\n ...MODELS_COLLECTION_BINDING,\n] as const satisfies Binder;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decocms/bindings",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "build": "tsup",
@@ -24,6 +24,16 @@
24
24
  "source": "./src/index.ts",
25
25
  "types": "./dist/index.d.ts",
26
26
  "default": "./dist/index.js"
27
+ },
28
+ "./models": {
29
+ "source": "./src/well-known/models.ts",
30
+ "types": "./dist/well-known/models.d.ts",
31
+ "default": "./dist/well-known/models.js"
32
+ },
33
+ "./collections": {
34
+ "source": "./src/well-known/collections.ts",
35
+ "types": "./dist/well-known/collections.d.ts",
36
+ "default": "./dist/well-known/collections.js"
27
37
  }
28
38
  },
29
39
  "devDependencies": {
@@ -13,82 +13,16 @@ import type { ToolBinder } from "../core/binder";
13
13
  * - Compatible with TanStack DB query-collection
14
14
  * - Full TypeScript support with proper type constraints
15
15
  * - Support for filtering, sorting, and pagination
16
- * - Collection URI format: rsc://{connectionid}/{collection_name}/{item_id}
16
+ * - Simple id and title fields for human-readable identification
17
17
  */
18
18
 
19
- /**
20
- * Collection URI format validation
21
- * Format: rsc://{connectionid}/{collection_name}/{item_id}
22
- */
23
- export const CollectionUriSchema = z
24
- .string()
25
- .regex(
26
- /^rsc:\/\/[^/]+\/[^/]+\/.+$/,
27
- "Invalid collection URI format. Expected format: rsc://{connectionid}/{collection_name}/{item_id}",
28
- );
29
-
30
- /**
31
- * Utility function to validate a collection URI format
32
- *
33
- * @param uri - The URI to validate
34
- * @returns True if the URI is valid, false otherwise
35
- */
36
- export function validateCollectionUri(uri: string): boolean {
37
- return CollectionUriSchema.safeParse(uri).success;
38
- }
39
-
40
- /**
41
- * Utility function to parse a collection URI into its components
42
- *
43
- * @param uri - The URI to parse
44
- * @returns Object containing the parsed components or null if invalid
45
- */
46
- export function parseCollectionUri(uri: string): {
47
- connectionId: string;
48
- collectionName: string;
49
- itemId: string;
50
- } | null {
51
- const result = CollectionUriSchema.safeParse(uri);
52
- if (!result.success) {
53
- return null;
54
- }
55
-
56
- const match = result.data.match(/^rsc:\/\/([^/]+)\/([^/]+)\/(.+)$/);
57
- if (!match) {
58
- return null;
59
- }
60
-
61
- return {
62
- connectionId: decodeURIComponent(match[1]),
63
- collectionName: decodeURIComponent(match[2]),
64
- itemId: decodeURIComponent(match[3]),
65
- };
66
- }
67
-
68
- /**
69
- * Utility function to construct a collection URI from components
70
- *
71
- * @param connectionId - The connection identifier
72
- * @param collectionName - The collection name
73
- * @param itemId - The item identifier
74
- * @returns The constructed collection URI
75
- */
76
- export function constructCollectionUri(
77
- connectionId: string,
78
- collectionName: string,
79
- itemId: string,
80
- ): string {
81
- return `rsc://${encodeURIComponent(connectionId)}/${
82
- encodeURIComponent(collectionName)
83
- }/${encodeURIComponent(itemId)}`;
84
- }
85
-
86
19
  /**
87
20
  * Base schema for collection entities
88
- * All collection entities must have a uri field and audit trail fields
21
+ * All collection entities must have an id, title, and audit trail fields
89
22
  */
90
23
  export const BaseCollectionEntitySchema = z.object({
91
- uri: z.string(),
24
+ id: z.string().describe("Unique identifier for the entity"),
25
+ title: z.string().describe("Human-readable title for the entity"),
92
26
  created_at: z.string().datetime(),
93
27
  updated_at: z.string().datetime(),
94
28
  created_by: z.string().optional(),
@@ -200,10 +134,10 @@ export function createCollectionListOutputSchema<T extends z.ZodTypeAny>(
200
134
  }
201
135
 
202
136
  /**
203
- * Get by URI input schema
137
+ * Get by ID input schema
204
138
  */
205
139
  export const CollectionGetInputSchema = z.object({
206
- uri: CollectionUriSchema.describe("URI of the entity to retrieve"),
140
+ id: z.string().describe("ID of the entity to retrieve"),
207
141
  });
208
142
 
209
143
  /**
@@ -225,9 +159,9 @@ export function createCollectionGetOutputSchema<T extends z.ZodTypeAny>(
225
159
  export function createCollectionInsertInputSchema<T extends z.ZodTypeAny>(
226
160
  entitySchema: T,
227
161
  ) {
228
- // Remove uri field since it's auto-generated from connectionId/collectionName/itemId
162
+ // Remove id field since it may be auto-generated by the server
229
163
  return z.object({
230
- data: entitySchema.describe("Data for the new entity (without uri)"),
164
+ data: entitySchema.describe("Data for the new entity (id may be auto-generated)"),
231
165
  });
232
166
  }
233
167
 
@@ -238,7 +172,7 @@ export function createCollectionInsertOutputSchema<T extends z.ZodTypeAny>(
238
172
  entitySchema: T,
239
173
  ) {
240
174
  return z.object({
241
- item: entitySchema.describe("The created entity with generated URI"),
175
+ item: entitySchema.describe("The created entity with generated id"),
242
176
  });
243
177
  }
244
178
 
@@ -249,7 +183,7 @@ export function createCollectionUpdateInputSchema<T extends z.ZodTypeAny>(
249
183
  entitySchema: T,
250
184
  ) {
251
185
  return z.object({
252
- uri: CollectionUriSchema.describe("URI of the entity to update"),
186
+ id: z.string().describe("ID of the entity to update"),
253
187
  data: (entitySchema as unknown as z.AnyZodObject)
254
188
  .partial()
255
189
  .describe("Partial entity data to update"),
@@ -271,7 +205,7 @@ export function createCollectionUpdateOutputSchema<T extends z.ZodTypeAny>(
271
205
  * Delete input schema
272
206
  */
273
207
  export const CollectionDeleteInputSchema = z.object({
274
- uri: CollectionUriSchema.describe("URI of the entity to delete"),
208
+ id: z.string().describe("ID of the entity to delete"),
275
209
  });
276
210
 
277
211
  /**
@@ -279,7 +213,7 @@ export const CollectionDeleteInputSchema = z.object({
279
213
  */
280
214
  export const CollectionDeleteOutputSchema = z.object({
281
215
  success: z.boolean().describe("Whether the deletion was successful"),
282
- uri: CollectionUriSchema.describe("URI of the deleted entity"),
216
+ id: z.string().describe("ID of the deleted entity"),
283
217
  });
284
218
 
285
219
  /**
@@ -299,7 +233,7 @@ export interface CollectionBindingOptions {
299
233
  * This function generates standardized tool bindings that work with any collection/table
300
234
  * by accepting a custom entity schema and collection name. The bindings provide:
301
235
  * - DECO_COLLECTION_{NAME}_LIST - Query/search entities with filtering and sorting (required)
302
- * - DECO_COLLECTION_{NAME}_GET - Get a single entity by URI (required)
236
+ * - DECO_COLLECTION_{NAME}_GET - Get a single entity by ID (required)
303
237
  * - DECO_COLLECTION_{NAME}_INSERT - Create a new entity (optional, excluded if readOnly=true)
304
238
  * - DECO_COLLECTION_{NAME}_UPDATE - Update an existing entity (optional, excluded if readOnly=true)
305
239
  * - DECO_COLLECTION_{NAME}_DELETE - Delete an entity (optional, excluded if readOnly=true)
@@ -312,12 +246,12 @@ export interface CollectionBindingOptions {
312
246
  * @example
313
247
  * ```typescript
314
248
  * const UserSchema = z.object({
315
- * uri: z.string(),
249
+ * id: z.string(),
250
+ * title: z.string(),
316
251
  * created_at: z.string().datetime(),
317
252
  * updated_at: z.string().datetime(),
318
253
  * created_by: z.string().optional(),
319
254
  * updated_by: z.string().optional(),
320
- * name: z.string(),
321
255
  * email: z.string().email(),
322
256
  * });
323
257
  *
@@ -393,7 +327,6 @@ export type CollectionTools<
393
327
  > = CollectionBinding<TEntitySchema>[number]["name"];
394
328
 
395
329
  // Export types for TypeScript usage
396
- export type CollectionUri = z.infer<typeof CollectionUriSchema>;
397
330
  export type CollectionListInput = z.infer<typeof CollectionListInputSchema>;
398
331
  export type CollectionGetInput = z.infer<typeof CollectionGetInputSchema>;
399
332
  export type CollectionDeleteInput = z.infer<typeof CollectionDeleteInputSchema>;
@@ -4,8 +4,8 @@
4
4
  * Defines the interface for AI model providers.
5
5
  * Any MCP that implements this binding can provide AI models and streaming endpoints.
6
6
  *
7
- * This binding uses collection bindings for LIST and GET operations (read-only),
8
- * and adds a GET_STREAM_ENDPOINT tool for streaming functionality.
7
+ * This binding uses collection bindings for LIST and GET operations (read-only).
8
+ * Streaming endpoint information is included directly in the model entity schema.
9
9
  */
10
10
 
11
11
  import { z } from "zod";
@@ -18,19 +18,28 @@ import {
18
18
  /**
19
19
  * Model entity schema for AI models
20
20
  * Extends BaseCollectionEntitySchema with model-specific fields
21
+ * Base schema already includes: id, title, created_at, updated_at, created_by, updated_by
21
22
  */
22
23
  const ModelSchema = BaseCollectionEntitySchema.extend({
23
24
  // Model-specific fields
24
- id: z.string(),
25
- model: z.string(),
26
- name: z.string(),
27
25
  logo: z.string().nullable(),
28
- capabilities: z.array(z.string()),
29
- contextWindow: z.number().nullable(),
30
- inputCost: z.number().nullable(),
31
- outputCost: z.number().nullable(),
32
- outputLimit: z.number().nullable(),
33
26
  description: z.string().nullable(),
27
+ capabilities: z.array(z.string()),
28
+ limits: z.object({
29
+ contextWindow: z.number(),
30
+ maxOutputTokens: z.number(),
31
+ }).nullable(),
32
+ costs: z.object({
33
+ input: z.number(),
34
+ output: z.number(),
35
+ }).nullable(),
36
+ // Streaming endpoint information
37
+ endpoint: z.object({
38
+ url: z.string().url(),
39
+ method: z.string().default("POST"),
40
+ contentType: z.string().default("application/json"),
41
+ stream: z.boolean().default(true),
42
+ }).nullable(),
34
43
  });
35
44
 
36
45
  /**
@@ -53,17 +62,8 @@ export const MODELS_COLLECTION_BINDING = createCollectionBindings(
53
62
  *
54
63
  * Required tools:
55
64
  * - DECO_COLLECTION_MODELS_LIST: List available AI models with their capabilities
56
- * - DECO_COLLECTION_MODELS_GET: Get a single model by URI
57
- * - GET_STREAM_ENDPOINT: Get the streaming endpoint URL for chat completions
65
+ * - DECO_COLLECTION_MODELS_GET: Get a single model by ID (includes streaming endpoint info)
58
66
  */
59
67
  export const MODELS_BINDING = [
60
68
  ...MODELS_COLLECTION_BINDING,
61
- {
62
- name: "GET_STREAM_ENDPOINT" as const,
63
- inputSchema: z.object({}).passthrough(),
64
- outputSchema: z.object({
65
- url: z.string().url(),
66
- }).partial(),
67
- },
68
69
  ] as const satisfies Binder;
69
-