Skip to main content
Glama
RestDB

Codehooks.io MCP Server

by RestDB

file_upload

Upload file content to a specified target path on the server using text or base64 encoding.

Instructions

Upload files to server

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYesFile content as text or base64
encodingNoContent encoding typetext
targetYesTarget path/filename on server

Implementation Reference

  • Zod schema for file_upload input validation: defines content (string), encoding (enum 'text'|'base64', defaults to 'text'), and target (string) fields.
    const fileUploadSchema = z.object({
        content: z.string().describe("File content as text or base64"),
        encoding: z.enum(["text", "base64"]).optional().default("text").describe("Content encoding type"),
        target: z.string().describe("Target path/filename on server")
    });
  • Handler for file_upload tool. Writes content to a temp file (decoding base64 if needed), executes 'coho file-upload' CLI command with --src and --target args, then cleans up the temp file.
    case "file_upload": {
        const { content, encoding = "text", target } = args as FileUploadArgs;
    
        // Content-based upload (base64 or text)
        const tempPath = `/tmp/${path.basename(target)}`;
    
        try {
            if (encoding === "base64") {
                // Decode base64 content to binary
                const buffer = Buffer.from(content, 'base64');
                await fs.writeFile(tempPath, buffer);
            } else {
                // Write text content
                await fs.writeFile(tempPath, content, 'utf8');
            }
    
            // Upload the temporary file
            const uploadArgs = [
                'file-upload',
                '--projectname', config.projectId,
                '--space', config.space,
                '--src', tempPath,
                '--target', target
            ];
    
            const result = await executeCohoCommand(uploadArgs);
    
            // Clean up temporary file
            await fs.unlink(tempPath);
    
            return {
                content: [
                    {
                        type: "text",
                        text: result
                    }
                ],
                isError: false
            };
        } catch (error: any) {
            // Clean up temporary file on error
            try {
                await fs.unlink(tempPath);
            } catch (unlinkError) {
                // Ignore cleanup errors
            }
            throw error;
        }
    }
  • src/index.ts:263-277 (registration)
    Tool registration for 'file_upload' in the tools array. Defines name, description, links to fileUploadSchema, and provides inputSchema JSON for the MCP ListTools response.
    {
        name: "file_upload",
        description: "Upload files to server",
        schema: fileUploadSchema,
        inputSchema: {
            type: "object",
            properties: {
                content: { type: "string", description: "File content as text or base64" },
                encoding: { type: "string", enum: ["text", "base64"], default: "text", description: "Content encoding type" },
                target: { type: "string", description: "Target path/filename on server" },
            },
            required: ["target", "content"],
            description: "Upload file content to server with specified target path"
        }
    },
Behavior1/5

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

No annotations are present, and the description does not disclose critical behaviors such as overwrite policies, request size limits, or error handling. The bare description 'Upload files to server' leaves the agent uninformed about consequences of invocation.

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

Conciseness4/5

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

The description is a single sentence with no extraneous text. However, its brevity sacrifices important details, such as clarifying the encoding parameter or the nature of the target path. It is concise but not optimally informative.

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?

With no output schema, no annotations, and 3 parameters, the description should cover usage context and return behavior. It only states the basic action, leaving gaps about success indicators, error messages, and whether the upload is synchronous.

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%, with each parameter having a functional description. The tool description adds no extra meaning beyond stating the overall action. For a 3-parameter tool with full schema coverage, baseline 3 is appropriate.

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 'Upload files to server' states a clear verb and resource, distinguishing it from sibling tools like file_list and file_delete. However, it lacks details about supported content types (text or base64) and the upload mechanism.

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 (e.g., kv_set for key-value storage) or on prerequisites like file size limits or authentication. The description implies use for file uploads but offers no context for decision-making.

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