feishu-mcp 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,6 +8,21 @@ import { createDocument, getDocumentInfo, getDocumentBlocks, searchDocuments, ba
8
8
  import { createTasks, listTasks, updateTask, deleteTasks } from '../modules/task/toolApi/index.js';
9
9
  // Member toolApis
10
10
  import { getUsers } from '../modules/member/toolApi/index.js';
11
+ /** 将 getImageResource 返回的 Buffer 转为 base64 字符串输出 */
12
+ async function getImageResourceAsBase64(mediaId, extra, svc) {
13
+ const result = await getImageResource(mediaId, extra, svc);
14
+ const buf = result instanceof Buffer ? result : Buffer.from(result.data);
15
+ return { base64: buf.toString('base64') };
16
+ }
17
+ /** 将 getWhiteboardContent 返回的 Buffer 缩略图转为 base64 字符串输出 */
18
+ async function getWhiteboardContentSafe(whiteboardId, svc) {
19
+ const result = await getWhiteboardContent(whiteboardId, svc);
20
+ if (result.type === 'thumbnail') {
21
+ const buf = result.buffer instanceof Buffer ? result.buffer : Buffer.from(result.buffer.data);
22
+ return { type: 'thumbnail', base64: buf.toString('base64') };
23
+ }
24
+ return result;
25
+ }
11
26
  /**
12
27
  * 按模块组织的工具注册表,与 src/modules 目录划分保持一致
13
28
  */
@@ -22,10 +37,10 @@ const MODULE_REGISTRY = {
22
37
  batch_update_feishu_block_text: (p, s) => batchUpdateBlockText(p, s),
23
38
  batch_create_feishu_blocks: (p, s) => batchCreateBlocks(p, s),
24
39
  delete_feishu_document_blocks: (p, s) => deleteDocumentBlocks(p, s),
25
- get_feishu_image_resource: (p, s) => getImageResource(p.mediaId, p.extra ?? '', s),
40
+ get_feishu_image_resource: (p, s) => getImageResourceAsBase64(p.mediaId, p.extra ?? '', s),
26
41
  upload_and_bind_image_to_block: (p, s) => uploadAndBindImageToBlock(p, s),
27
42
  create_feishu_table: (p, s) => createTable(p, s),
28
- get_feishu_whiteboard_content: (p, s) => getWhiteboardContent(p.whiteboardId, s),
43
+ get_feishu_whiteboard_content: (p, s) => getWhiteboardContentSafe(p.whiteboardId, s),
29
44
  fill_whiteboard_with_plantuml: (p, s) => fillWhiteboardWithPlantuml(p, s),
30
45
  get_feishu_root_folder_info: (_p, s) => getRootFolderInfo(s),
31
46
  get_feishu_folder_files: (p, s) => getFolderFiles(p, s),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "feishu-mcp",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Model Context Protocol server for Feishu integration",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",