Skip to main content
Glama

Upload Blob

affine_upload_blob

Upload files or blobs to workspace storage by specifying workspace ID, content, filename, and MIME type. Integrates with AFFiNE MCP Server for efficient workspace data management.

Instructions

Upload a file or blob to workspace storage.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYesBase64 encoded content or text
contentTypeNoMIME type
filenameNoFilename
workspaceIdYesWorkspace ID

Implementation Reference

  • The uploadBlobHandler async function that executes the affine_upload_blob tool logic. It generates a mock blob ID, computes size, and returns structured metadata (simplified implementation without actual upload).
    const uploadBlobHandler = async ({ workspaceId, content, filename, contentType }: { workspaceId: string; content: string; filename?: string; contentType?: string }) => {
      try {
        // Note: Actual file upload requires multipart form data
        // This is a simplified version that returns structured data
        const blobId = `blob_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
        
        return text({
          id: blobId,
          workspaceId,
          filename: filename || "unnamed",
          contentType: contentType || "application/octet-stream",
          size: content.length,
          uploadedAt: new Date().toISOString(),
          note: "Blob metadata created. Use AFFiNE UI for actual file upload."
        });
      } catch (error: any) {
        return text({ error: error.message });
      }
    };
  • Input schema using Zod for validating tool parameters: required workspaceId and content (base64 string), optional filename and contentType.
    inputSchema: {
      workspaceId: z.string().describe("Workspace ID"),
      content: z.string().describe("Base64 encoded content or text"),
      filename: z.string().optional().describe("Filename"),
      contentType: z.string().optional().describe("MIME type")
    }
  • Registration of the 'affine_upload_blob' tool via McpServer.registerTool(), including title, description, schema, and reference to the handler function.
    server.registerTool(
      "affine_upload_blob",
      {
        title: "Upload Blob",
        description: "Upload a file or blob to workspace storage.",
        inputSchema: {
          workspaceId: z.string().describe("Workspace ID"),
          content: z.string().describe("Base64 encoded content or text"),
          filename: z.string().optional().describe("Filename"),
          contentType: z.string().optional().describe("MIME type")
        }
      },
      uploadBlobHandler as any
    );
  • src/index.ts:73-73 (registration)
    Top-level call to registerBlobTools during server initialization, which in turn registers the affine_upload_blob tool.
    registerBlobTools(server, gql);
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('Upload') but lacks details on permissions required, rate limits, whether the operation is idempotent, what happens on conflicts (e.g., duplicate filenames), or the response format. This is inadequate for a mutation tool with zero annotation coverage.

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?

The description is a single, efficient sentence with zero waste. It's appropriately sized and front-loaded, clearly stating the tool's purpose without unnecessary elaboration.

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?

Given the tool's complexity (a mutation operation with 4 parameters), lack of annotations, and no output schema, the description is incomplete. It doesn't address behavioral aspects like error handling, success responses, or integration with sibling tools, leaving significant gaps for agent understanding.

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 description coverage is 100%, so the schema fully documents all parameters (content, contentType, filename, workspaceId). The description adds no additional meaning beyond what the schema provides, such as examples or constraints, meeting the baseline for high schema coverage.

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 clearly states the action ('Upload') and resource ('a file or blob to workspace storage'), providing a specific verb+resource combination. However, it doesn't distinguish this from sibling tools like 'affine_delete_blob' or 'affine_cleanup_blobs' that also operate on blobs, missing explicit differentiation.

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. It doesn't mention prerequisites (e.g., authentication), exclusions, or compare it to sibling tools like 'affine_delete_blob' or 'affine_cleanup_blobs' for blob management, leaving usage context unclear.

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

Related 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/DAWNCR0W/affine-mcp-server'

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