Skip to main content
Glama
RestDB

Codehooks.io MCP Server

by RestDB

create_collection

Creates a new database collection to organize and store data in your Codehooks.io project.

Instructions

Create a new collection

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
collectionYesName of collection to create

Implementation Reference

  • Zod schema definition for create_collection tool. Defines a 'collection' string parameter describing the name of the collection to create.
    const createCollectionSchema = z.object({
        collection: z.string().describe("Name of collection to create"),
    });
  • src/index.ts:328-339 (registration)
    Tool registration in the tools array. Registers 'create_collection' with description 'Create a new collection' and its inputSchema referencing createCollectionSchema.
    {
        name: "create_collection",
        description: "Create a new collection",
        schema: createCollectionSchema,
        inputSchema: {
            type: "object",
            properties: {
                collection: { type: "string", description: "Name of collection to create" }
            },
            required: ["collection"]
        }
    },
  • Handler implementation for create_collection. Extracts the 'collection' argument, builds CLI args calling 'coho createcollection' with project, space, and collection name, then executes the command and returns the result.
    case "create_collection": {
        const { collection } = args as CreateCollectionArgs;
        const createCollArgs = [
            'createcollection',
            '--project', config.projectId,
            '--space', config.space,
            collection
        ];
        const result = await executeCohoCommand(createCollArgs);
        return {
            content: [
                {
                    type: "text",
                    text: result
                }
            ],
            isError: false
        };
    }
  • Helper function executeCohoCommand that all tool handlers use to run the coho CLI. Handles execution, error sanitization (admin token redaction), and timeout.
    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}`);
        }
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description bears full responsibility for behavioral disclosure. It only states 'Create a new collection', implying a write operation, but gives no details on side effects, permissions, or limits.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence, which is concise, but it lacks structure and detail. It is too minimal to be considered well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Despite having only one parameter and no output schema, the description is incomplete. It does not explain what a collection is, what happens upon success, or how it fits with sibling tools like 'add_schema' or 'query_collection'.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% coverage for the single parameter 'collection', with a clear description 'Name of collection to create'. The tool description adds no additional meaning beyond the schema, so it meets the baseline.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Create a new collection' states a verb and resource, making it clear that this tool creates a collection. However, it lacks specificity about what a collection is in this context, and does not differentiate from sibling tools like 'collection' or 'add_schema'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives such as 'cap_collection', 'drop_collection', or 'query_collection'. It does not state prerequisites or when not to use it.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/RestDB/codehooks-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server