Skip to main content
Glama

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);

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