Skip to main content
Glama
RestDB

Codehooks.io MCP Server

by RestDB

import

Import data into a collection from a file path or content string, supporting JSON and CSV formats.

Instructions

Import data from file or content. Provide either 'filepath' (for files inside Docker container) or 'content' (JSON/CSV data as string).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filepathNoFile path to import from (optional if content is provided)
contentNoFile content to import as JSON or CSV data (optional if filepath is provided)
collectionYesCollection to import into
separatorNoCSV separator character
encodingNoFile encoding

Implementation Reference

  • The Zod schema for the 'import' tool, defining input parameters: filepath, content, collection, separator, and encoding.
    const importSchema = z.object({
        filepath: z.string().optional().describe("File path to import from (optional if content is provided)"),
        content: z.string().optional().describe("File content to import (JSON or CSV data)"),
        collection: z.string().describe("Collection to import into"),
        separator: z.string().optional().describe("CSV separator character"),
        encoding: z.string().optional().describe("File encoding"),
    });
  • src/index.ts:402-417 (registration)
    Registration of the 'import' tool in the tools array, with its name, description, schema reference, and inputSchema.
    {
        name: "import",
        description: "Import data from file or content. Provide either 'filepath' (for files inside Docker container) or 'content' (JSON/CSV data as string).",
        schema: importSchema,
        inputSchema: {
            type: "object",
            properties: {
                filepath: { type: "string", description: "File path to import from (optional if content is provided)" },
                content: { type: "string", description: "File content to import as JSON or CSV data (optional if filepath is provided)" },
                collection: { type: "string", description: "Collection to import into" },
                separator: { type: "string", description: "CSV separator character" },
                encoding: { type: "string", description: "File encoding" }
            },
            required: ["collection"]
        }
    },
  • The handler function for the 'import' tool. Executes the coho CLI 'import' command with arguments built from validated input. Supports providing data via filepath or inline content (written to a temp file). Cleans up temp files after execution.
    case "import": {
        const { filepath, content, collection, separator, encoding } = args as ImportArgs;
    
        if (!filepath && !content) {
            throw new McpError(ErrorCode.InvalidRequest, "Either 'filepath' or 'content' must be provided.");
        }
    
        let tempFilePath: string | undefined;
    
        try {
            const importArgs = [
                'import',
                '--project', config.projectId,
                '--space', config.space,
                '--collection', collection
            ];
    
            if (content) {
                // Create temporary file with content
                tempFilePath = `/tmp/import-${Date.now()}.json`;
                await fs.writeFile(tempFilePath, content, { encoding: (encoding as BufferEncoding) || 'utf8' });
                importArgs.push('--filepath', tempFilePath);
            } else if (filepath) {
                importArgs.push('--filepath', filepath);
            }
    
            if (separator) {
                importArgs.push('--separator', separator);
            }
    
            if (encoding) {
                importArgs.push('--encoding', encoding);
            }
    
            const result = await executeCohoCommand(importArgs);
    
            // Clean up temp file if created
            if (tempFilePath) {
                await fs.unlink(tempFilePath);
            }
    
            return {
                content: [
                    {
                        type: "text",
                        text: result
                    }
                ],
                isError: false
            };
        } catch (error) {
            // Clean up temp file on error
            if (tempFilePath) {
                try {
                    await fs.unlink(tempFilePath);
                } catch (unlinkError) {
                    // Ignore cleanup errors
                }
            }
            throw error;
        }
    }
Behavior2/5

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

No annotations provided, and description does not disclose behavioral traits such as whether import overwrites existing data, what happens on failure, or authorization requirements. This is a significant gap for a mutation tool.

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 sentences, front-loaded with primary purpose, no redundant information. Every sentence is efficient and 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?

Covers main input methods but does not explain optional parameters like separator and encoding, nor return value or success/failure indications. With no output schema and 5 parameters, more detail is warranted.

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

Parameters4/5

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

Schema has 100% description coverage, but description adds context: clarifies that 'filepath' is for files inside Docker container and 'content' is JSON/CSV string, which goes beyond schema descriptions.

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?

Description clearly states the tool imports data from file or content, distinguishing it from sibling 'export' which does the opposite, and 'file_upload' which handles file transfer not data import.

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

Usage Guidelines3/5

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

Description mentions providing either 'filepath' or 'content', implying when to use each, but lacks guidance on when to prefer this tool over alternatives like direct API calls or file_upload, and no exclusion criteria.

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