Skip to main content
Glama
RestDB

Codehooks.io MCP Server

by RestDB

add_schema

Adds a JSON schema to a database collection. Specify the schema as a JSON string to enforce structure.

Instructions

Add a JSON schema to a collection. Provide the schema content as a JSON string.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
collectionYesCollection name
schemaYesJSON schema content as a string (will be written to temporary file for CLI)

Implementation Reference

  • src/index.ts:352-364 (registration)
    Registration of the 'add_schema' tool in the tools array, including its name, description, and input schema.
    {
        name: "add_schema",
        description: "Add a JSON schema to a collection. Provide the schema content as a JSON string.",
        schema: schemaSchema,
        inputSchema: {
            type: "object",
            properties: {
                collection: { type: "string", description: "Collection name" },
                schema: { type: "string", description: "JSON schema content as a string (will be written to temporary file for CLI)" }
            },
            required: ["collection", "schema"]
        }
    },
  • Zod validation schema for add_schema: requires a 'collection' (string) and 'schema' (string - JSON schema content).
    const schemaSchema = z.object({
        collection: z.string().describe("Collection name"),
        schema: z.string().describe("JSON schema to add"),
    });
  • Handler implementation for add_schema: writes schema content to a temp file, calls coho CLI 'add-schema' command, then cleans up the temp file.
    case "add_schema": {
        const { collection, schema } = args as SchemaArgs;
    
        // Write schema to temp file
        const tempSchemaPath = `/tmp/schema-${Date.now()}.json`;
        try {
            await fs.writeFile(tempSchemaPath, schema);
    
            const schemaArgs = [
                'add-schema',
                '--project', config.projectId,
                '--space', config.space,
                '--collection', collection,
                '--schema', tempSchemaPath
            ];
    
            const result = await executeCohoCommand(schemaArgs);
    
            // Clean up temp file
            await fs.unlink(tempSchemaPath);
    
            return {
                content: [
                    {
                        type: "text",
                        text: result
                    }
                ],
                isError: false
            };
        } catch (error) {
            // Clean up temp file on error
            try {
                await fs.unlink(tempSchemaPath);
            } catch (unlinkError) {
                // Ignore cleanup errors
            }
            throw error;
        }
    }
Behavior2/5

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

Without annotations, the description carries the full burden of behavioral disclosure. It does not mention whether adding a schema overwrites existing schemas, validates content, or requires specific permissions. The mention of a temporary file for CLI is a minor behavioural hint but insufficient.

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

Conciseness5/5

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

Two concise sentences that convey the core functionality without unnecessary elaboration. Every word earns its place, making it easy for an agent to parse quickly.

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

Completeness3/5

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

Given the lack of annotations, output schema, and moderate complexity (two required parameters), the description is minimally adequate. It fails to mention return values, error handling, or whether the schema replaces or appends, leaving gaps for an agent.

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?

Input schema coverage is 100% for both parameters. The description adds 'JSON string' context, reinforcing the schema's description. This meets the baseline expectation but does not provide additional semantic value beyond what the schema already conveys.

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

Purpose5/5

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

The description clearly states the action ('Add a JSON schema to a collection') and what is required ('Provide the schema content as a JSON string'). It effectively distinguishes this tool from its siblings like 'remove_schema' and collection operations.

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?

No guidance is provided on when to use this tool versus alternatives such as 'create_collection', 'update_collection', or 'remove_schema'. The description lacks any context about prerequisites or typical usage scenarios.

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