get_upload_token
Generate upload credentials for posting images to cloud storage, enabling subsequent note creation with image attachments.
Instructions
获取 OSS 图片上传凭证。返回 accessid/host/policy/signature 等字段,用于 multipart/form-data POST 上传图片到阿里云 OSS。上传成功后获取 image_id,再用 save_note 创建图片笔记。⚠️ mime_type 必须与实际文件格式一致,否则 OSS 签名失败。
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mime_type | No | 图片类型:jpg | png | gif | webp,默认 png | |
| count | No | 需要的 token 数量,默认 1,最大 9(批量上传时使用) |
Implementation Reference
- src/client.ts:158-164 (handler)The implementation of the getUploadToken tool logic, which makes a GET request to the OSS upload token endpoint.
async getUploadToken(params: { count?: number; mime_type?: string }) { return this.request<GetUploadTokenResp>( "GET", "/resource/image/upload_token", { count: params.count, mime_type: params.mime_type } ); } - src/index.ts:341-359 (registration)The registration and input schema for the get_upload_token MCP tool.
name: "get_upload_token", description: "获取 OSS 图片上传凭证。返回 accessid/host/policy/signature 等字段,用于 multipart/form-data POST 上传图片到阿里云 OSS。上传成功后获取 image_id,再用 save_note 创建图片笔记。⚠️ mime_type 必须与实际文件格式一致,否则 OSS 签名失败。", inputSchema: { type: "object" as const, properties: { mime_type: { type: "string", enum: ["jpg", "png", "gif", "webp", "jpeg"], description: "图片类型:jpg | png | gif | webp,默认 png", }, count: { type: "number", description: "需要的 token 数量,默认 1,最大 9(批量上传时使用)", default: 1, }, }, required: [], }, - src/index.ts:646-651 (handler)The switch case handler that dispatches the get_upload_token tool request to the client implementation.
case "get_upload_token": { return client.getUploadToken({ mime_type: input.mime_type as string | undefined, count: input.count as number | undefined, }); }