upload_image
Upload images to cloud storage for use in GetNote platform notes. Accepts local file paths or Base64 data and returns image URLs for embedding in documents.
Instructions
上传图片到 OSS。返回 image_url(用于创建图片笔记的 image_urls 参数)。
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| image_path | No | 本地图片文件路径 | |
| image_base64 | No | 图片的 Base64 编码数据(与 image_path 二选一) | |
| mime_type | No | 图片类型(如 png、jpg、jpeg),默认 png | png |
Implementation Reference
- src/index.ts:668-673 (handler)MCP tool handler case for "upload_image" which orchestrates reading the image and calling the client method.
const result = await client.uploadImage(imageData, mimeType); return { success: true, image_url: result.access_url, // 用于创建图片笔记 image_id: result.image_id // OSS 回调返回的 ID }; - src/client.ts:216-228 (handler)Implementation of uploadImage in the client class.
async uploadImage( imageData: Buffer | Uint8Array, mimeType: string = "png" ): Promise<{ image_id: string; access_url: string }> { // 1. 获取上传凭证(现在直接返回单个对象) const token = await this.getUploadToken({ mime_type: mimeType }); // 2. 上传到 OSS const { image_id } = await this.uploadImageToOSS(token, imageData); // 3. 返回结果 return { image_id, access_url: token.access_url }; } - src/index.ts:362-381 (registration)MCP tool registration for "upload_image".
name: "upload_image", description: "上传图片到 OSS。返回 image_url(用于创建图片笔记的 image_urls 参数)。", inputSchema: { type: "object" as const, properties: { image_path: { type: "string", description: "本地图片文件路径", }, image_base64: { type: "string", description: "图片的 Base64 编码数据(与 image_path 二选一)", }, mime_type: { type: "string", description: "图片类型(如 png、jpg、jpeg),默认 png", default: "png", }, },