uncap_collection
Remove the cap from a collection to enable unrestricted document insertion and modification without size limits.
Instructions
Remove cap from a collection
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| collection | Yes | Collection to remove cap from |
Implementation Reference
- src/index.ts:130-132 (schema)Zod schema for uncap_collection input validation: requires 'collection' (string) describing the collection to remove cap from.
const uncapCollectionSchema = z.object({ collection: z.string().describe("Collection to remove cap from"), }); - src/index.ts:390-401 (registration)Registration of the 'uncap_collection' tool in the tools array with name, description, and input schema.
{ name: "uncap_collection", description: "Remove cap from a collection", schema: uncapCollectionSchema, inputSchema: { type: "object", properties: { collection: { type: "string", description: "Collection to remove cap from" } }, required: ["collection"] } }, - src/index.ts:1101-1119 (handler)Handler for the 'uncap_collection' tool. Extracts 'collection' from args, builds a CLI command array with 'uncap-collection', project, space, and collection name, then executes via the coho CLI helper function.
case "uncap_collection": { const { collection } = args as UncapCollectionArgs; const uncapArgs = [ 'uncap-collection', '--project', config.projectId, '--space', config.space, collection ]; const result = await executeCohoCommand(uncapArgs); return { content: [ { type: "text", text: result } ], isError: false }; } - src/index.ts:529-564 (helper)The executeCohoCommand helper function that executes the 'coho' CLI with the constructed arguments. Used by uncap_collection handler to run 'coho uncap-collection --project ... --space ... <collection>'.
async function executeCohoCommand(args: string[]): Promise<string> { const safeArgs = ['coho', ...args, '--admintoken', '***']; console.error(`Executing command: ${safeArgs.join(' ')}`); try { const { stdout, stderr } = await execFile('coho', [...args, '--admintoken', config.adminToken], { timeout: 120000 // 2 minutes timeout for CLI operations }); if (stderr) { // Sanitize stderr before logging to avoid token exposure const safeSterr = stderr.replace(new RegExp(config.adminToken, 'g'), '***'); console.error(`Command output to stderr:`, safeSterr); } console.error(`Command successful`); const result = stdout || stderr; // Sanitize result to ensure admin token is not exposed return result ? result.replace(new RegExp(config.adminToken, 'g'), '***') : result; } catch (error: any) { // Comprehensive sanitization of all error properties to avoid admin token exposure const sanitizeText = (text: string): string => text ? text.replace(new RegExp(config.adminToken, 'g'), '***') : text; const sanitizedMessage = sanitizeText(error?.message || 'Unknown error'); const sanitizedCmd = sanitizeText(error?.cmd || ''); const sanitizedStdout = sanitizeText(error?.stdout || ''); const sanitizedStderr = sanitizeText(error?.stderr || ''); // Log sanitized error details console.error(`Command failed: ${sanitizedMessage}`); if (sanitizedCmd) console.error(`Command: ${sanitizedCmd}`); if (sanitizedStdout) console.error(`Stdout: ${sanitizedStdout}`); if (sanitizedStderr) console.error(`Stderr: ${sanitizedStderr}`); // Return sanitized error message const errorDetails = [sanitizedMessage, sanitizedStderr].filter(Boolean).join(' - '); throw new McpError(ErrorCode.InvalidRequest, `Command failed: ${errorDetails}`); } }