cap_collection
Set a maximum document limit on a database collection to control storage size.
Instructions
Cap a collection
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| collection | Yes | Collection name | |
| cap | Yes | Maximum number of documents |
Implementation Reference
- src/index.ts:125-128 (schema)Zod schema for cap_collection tool: defines input parameters (collection name and cap maximum document count).
const capCollectionSchema = z.object({ collection: z.string().describe("Collection name"), cap: z.number().describe("Maximum number of documents"), }); - src/index.ts:1080-1099 (handler)Handler case for cap_collection: builds CLI arguments and executes coho cap-collection command, returning stdout result.
case "cap_collection": { const { collection, cap } = args as CapCollectionArgs; const capArgs = [ 'cap-collection', '--project', config.projectId, '--space', config.space, '--cap', cap.toString(), collection ]; const result = await executeCohoCommand(capArgs); return { content: [ { type: "text", text: result } ], isError: false }; } - src/index.ts:377-389 (registration)Tool registration entry: defines the cap_collection tool with name, description, schema reference, and inputSchema for the tools/list response.
{ name: "cap_collection", description: "Cap a collection", schema: capCollectionSchema, inputSchema: { type: "object", properties: { collection: { type: "string", description: "Collection name" }, cap: { type: "number", description: "Maximum number of documents" } }, required: ["collection", "cap"] } }, - src/index.ts:195-196 (helper)Type inference helper: CapCollectionArgs type derived from the Zod schema.
type CapCollectionArgs = z.infer<typeof capCollectionSchema>; type UncapCollectionArgs = z.infer<typeof uncapCollectionSchema>;