Skip to main content
Glama
RestDB

Codehooks.io MCP Server

by RestDB

drop_index

Remove specified fields from a collection's query index to manage database indexing and optimize query performance.

Instructions

Remove field(s) from a query index

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
collectionYesCollection name
indexYesField(s) to remove from query index

Implementation Reference

  • Zod schema for drop_index input validation: requires 'collection' (string) and 'index' (string) fields.
    const dropIndexSchema = z.object({
        collection: z.string().describe("Collection name"),
        index: z.string().describe("Field(s) to remove from query index"),
    });
  • src/index.ts:315-327 (registration)
    Tool registration for 'drop_index' in the tools array with name, description, and inputSchema.
    {
        name: "drop_index",
        description: "Remove field(s) from a query index",
        schema: dropIndexSchema,
        inputSchema: {
            type: "object",
            properties: {
                collection: { type: "string", description: "Collection name" },
                index: { type: "string", description: "Field(s) to remove from query index" }
            },
            required: ["collection", "index"]
        }
    },
  • Handler for drop_index tool. Extracts collection and index args, then executes 'coho removeindex --project ... --space ... <collection> <index>' CLI command.
    case "drop_index": {
        const { collection, index } = args as DropIndexArgs;
        const dropIndexArgs = [
            'removeindex',
            '--project', config.projectId,
            '--space', config.space,
            collection,
            index
        ];
        const result = await executeCohoCommand(dropIndexArgs);
        return {
            content: [
                {
                    type: "text",
                    text: result
                }
            ],
            isError: false
        };
    }
  • Helper function executeCohoCommand that runs the coho CLI with sanitized admin token. Used by the drop_index handler to execute the removeindex command.
    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?

Annotations are absent, so the description bears full burden. It only states the action without disclosing side effects (e.g., is the operation irreversible? Does it affect existing queries? No details on performance or safety).

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?

Single sentence, no redundancy, perfectly front-loaded with the essential action. Every word earns its place.

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?

Simple two-parameter tool with no output schema. Description covers the basics but omits behavioral context (e.g., confirmation, error cases). Adequate for a straightforward operation but not rich.

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?

Schema coverage is 100% (both parameters have descriptions), so the description adds marginal value. It correctly implies the 'index' parameter holds field(s) to remove, but does not elaborate beyond schema definitions.

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

Purpose4/5

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

The description 'Remove field(s) from a query index' specifies the verb (remove) and resource (query index), clearly distinguishing from siblings like create_index or drop_collection. Lacks explicit contrast but the name and description make the purpose obvious.

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 on when to use this tool versus alternatives (e.g., drop_collection to remove entire collection). No prerequisites or conditions provided, leaving the agent to infer from the description.

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