feishu-user-plugin 1.2.0 → 1.3.0
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.
- package/package.json +2 -2
- package/skills/feishu-user-plugin/references/CLAUDE.md +295 -60
- package/src/index.js +675 -5
- package/src/official.js +425 -3
package/src/index.js
CHANGED
|
@@ -272,10 +272,10 @@ const TOOLS = [
|
|
|
272
272
|
},
|
|
273
273
|
{
|
|
274
274
|
name: 'get_chat_info',
|
|
275
|
-
description: '[User Identity] Get chat details: name, description, member count, owner.',
|
|
275
|
+
description: '[Official API + User Identity fallback] Get chat details: name, description, member count, owner. Supports both oc_xxx and numeric chat_id.',
|
|
276
276
|
inputSchema: {
|
|
277
277
|
type: 'object',
|
|
278
|
-
properties: { chat_id: { type: 'string', description: 'Chat ID' } },
|
|
278
|
+
properties: { chat_id: { type: 'string', description: 'Chat ID (oc_xxx or numeric)' } },
|
|
279
279
|
required: ['chat_id'],
|
|
280
280
|
},
|
|
281
281
|
},
|
|
@@ -421,6 +421,17 @@ const TOOLS = [
|
|
|
421
421
|
},
|
|
422
422
|
|
|
423
423
|
// ========== Bitable — Official API ==========
|
|
424
|
+
{
|
|
425
|
+
name: 'create_bitable',
|
|
426
|
+
description: '[Official API] Create a new Bitable (multi-dimensional table) app.',
|
|
427
|
+
inputSchema: {
|
|
428
|
+
type: 'object',
|
|
429
|
+
properties: {
|
|
430
|
+
name: { type: 'string', description: 'Bitable app name' },
|
|
431
|
+
folder_id: { type: 'string', description: 'Parent folder token (optional, defaults to root)' },
|
|
432
|
+
},
|
|
433
|
+
},
|
|
434
|
+
},
|
|
424
435
|
{
|
|
425
436
|
name: 'list_bitable_tables',
|
|
426
437
|
description: '[Official API] List all tables in a Bitable app.',
|
|
@@ -430,6 +441,23 @@ const TOOLS = [
|
|
|
430
441
|
required: ['app_token'],
|
|
431
442
|
},
|
|
432
443
|
},
|
|
444
|
+
{
|
|
445
|
+
name: 'create_bitable_table',
|
|
446
|
+
description: '[Official API] Create a new data table in a Bitable app. Optionally define initial fields.',
|
|
447
|
+
inputSchema: {
|
|
448
|
+
type: 'object',
|
|
449
|
+
properties: {
|
|
450
|
+
app_token: { type: 'string', description: 'Bitable app token' },
|
|
451
|
+
name: { type: 'string', description: 'Table name' },
|
|
452
|
+
fields: {
|
|
453
|
+
type: 'array',
|
|
454
|
+
description: 'Initial field definitions (optional). Each item: {field_name, type} where type is 1=Text, 2=Number, 3=SingleSelect, 4=MultiSelect, 5=DateTime, 7=Checkbox, 11=User, 13=Phone, 15=URL, 17=Attachment, 18=Link, 20=Formula, 21=DuplexLink, 22=Location, 23=GroupChat, 1001=CreateTime, 1002=ModifiedTime, 1003=Creator, 1004=Modifier',
|
|
455
|
+
items: { type: 'object' },
|
|
456
|
+
},
|
|
457
|
+
},
|
|
458
|
+
required: ['app_token', 'name'],
|
|
459
|
+
},
|
|
460
|
+
},
|
|
433
461
|
{
|
|
434
462
|
name: 'list_bitable_fields',
|
|
435
463
|
description: '[Official API] List all fields (columns) in a Bitable table.',
|
|
@@ -442,6 +470,62 @@ const TOOLS = [
|
|
|
442
470
|
required: ['app_token', 'table_id'],
|
|
443
471
|
},
|
|
444
472
|
},
|
|
473
|
+
{
|
|
474
|
+
name: 'create_bitable_field',
|
|
475
|
+
description: '[Official API] Create a new field (column) in a Bitable table.',
|
|
476
|
+
inputSchema: {
|
|
477
|
+
type: 'object',
|
|
478
|
+
properties: {
|
|
479
|
+
app_token: { type: 'string', description: 'Bitable app token' },
|
|
480
|
+
table_id: { type: 'string', description: 'Table ID' },
|
|
481
|
+
field_name: { type: 'string', description: 'Field display name' },
|
|
482
|
+
type: { type: 'number', description: 'Field type: 1=Text, 2=Number, 3=SingleSelect, 4=MultiSelect, 5=DateTime, 7=Checkbox, 11=User, 13=Phone, 15=URL, 17=Attachment, 18=Link, 20=Formula, 21=DuplexLink, 22=Location, 23=GroupChat, 1001=CreateTime, 1002=ModifiedTime, 1003=Creator, 1004=Modifier' },
|
|
483
|
+
property: { type: 'object', description: 'Field-type-specific properties (optional). E.g. for SingleSelect: {options: [{name:"A"},{name:"B"}]}' },
|
|
484
|
+
},
|
|
485
|
+
required: ['app_token', 'table_id', 'field_name', 'type'],
|
|
486
|
+
},
|
|
487
|
+
},
|
|
488
|
+
{
|
|
489
|
+
name: 'update_bitable_field',
|
|
490
|
+
description: '[Official API] Update an existing field (column) in a Bitable table.',
|
|
491
|
+
inputSchema: {
|
|
492
|
+
type: 'object',
|
|
493
|
+
properties: {
|
|
494
|
+
app_token: { type: 'string', description: 'Bitable app token' },
|
|
495
|
+
table_id: { type: 'string', description: 'Table ID' },
|
|
496
|
+
field_id: { type: 'string', description: 'Field ID to update' },
|
|
497
|
+
field_name: { type: 'string', description: 'New field name (optional)' },
|
|
498
|
+
type: { type: 'number', description: 'Field type (REQUIRED by Feishu API, see create_bitable_field for values)' },
|
|
499
|
+
property: { type: 'object', description: 'Field-type-specific properties (optional)' },
|
|
500
|
+
},
|
|
501
|
+
required: ['app_token', 'table_id', 'field_id', 'type'],
|
|
502
|
+
},
|
|
503
|
+
},
|
|
504
|
+
{
|
|
505
|
+
name: 'delete_bitable_field',
|
|
506
|
+
description: '[Official API] Delete a field (column) from a Bitable table.',
|
|
507
|
+
inputSchema: {
|
|
508
|
+
type: 'object',
|
|
509
|
+
properties: {
|
|
510
|
+
app_token: { type: 'string', description: 'Bitable app token' },
|
|
511
|
+
table_id: { type: 'string', description: 'Table ID' },
|
|
512
|
+
field_id: { type: 'string', description: 'Field ID to delete' },
|
|
513
|
+
},
|
|
514
|
+
required: ['app_token', 'table_id', 'field_id'],
|
|
515
|
+
},
|
|
516
|
+
},
|
|
517
|
+
{
|
|
518
|
+
name: 'list_bitable_views',
|
|
519
|
+
description: '[Official API] List all views in a Bitable table.',
|
|
520
|
+
inputSchema: {
|
|
521
|
+
type: 'object',
|
|
522
|
+
properties: {
|
|
523
|
+
app_token: { type: 'string', description: 'Bitable app token' },
|
|
524
|
+
table_id: { type: 'string', description: 'Table ID' },
|
|
525
|
+
},
|
|
526
|
+
required: ['app_token', 'table_id'],
|
|
527
|
+
},
|
|
528
|
+
},
|
|
445
529
|
{
|
|
446
530
|
name: 'search_bitable_records',
|
|
447
531
|
description: '[Official API] Search/query records in a Bitable table.',
|
|
@@ -484,6 +568,58 @@ const TOOLS = [
|
|
|
484
568
|
required: ['app_token', 'table_id', 'record_id', 'fields'],
|
|
485
569
|
},
|
|
486
570
|
},
|
|
571
|
+
{
|
|
572
|
+
name: 'delete_bitable_record',
|
|
573
|
+
description: '[Official API] Delete a record (row) from a Bitable table.',
|
|
574
|
+
inputSchema: {
|
|
575
|
+
type: 'object',
|
|
576
|
+
properties: {
|
|
577
|
+
app_token: { type: 'string', description: 'Bitable app token' },
|
|
578
|
+
table_id: { type: 'string', description: 'Table ID' },
|
|
579
|
+
record_id: { type: 'string', description: 'Record ID to delete' },
|
|
580
|
+
},
|
|
581
|
+
required: ['app_token', 'table_id', 'record_id'],
|
|
582
|
+
},
|
|
583
|
+
},
|
|
584
|
+
{
|
|
585
|
+
name: 'batch_create_bitable_records',
|
|
586
|
+
description: '[Official API] Batch create multiple records (rows) in a Bitable table. Max 500 per call.',
|
|
587
|
+
inputSchema: {
|
|
588
|
+
type: 'object',
|
|
589
|
+
properties: {
|
|
590
|
+
app_token: { type: 'string', description: 'Bitable app token' },
|
|
591
|
+
table_id: { type: 'string', description: 'Table ID' },
|
|
592
|
+
records: { type: 'array', description: 'Array of {fields: {field_name: value}} objects', items: { type: 'object' } },
|
|
593
|
+
},
|
|
594
|
+
required: ['app_token', 'table_id', 'records'],
|
|
595
|
+
},
|
|
596
|
+
},
|
|
597
|
+
{
|
|
598
|
+
name: 'batch_update_bitable_records',
|
|
599
|
+
description: '[Official API] Batch update multiple records in a Bitable table. Max 500 per call.',
|
|
600
|
+
inputSchema: {
|
|
601
|
+
type: 'object',
|
|
602
|
+
properties: {
|
|
603
|
+
app_token: { type: 'string', description: 'Bitable app token' },
|
|
604
|
+
table_id: { type: 'string', description: 'Table ID' },
|
|
605
|
+
records: { type: 'array', description: 'Array of {record_id, fields: {field_name: value}} objects', items: { type: 'object' } },
|
|
606
|
+
},
|
|
607
|
+
required: ['app_token', 'table_id', 'records'],
|
|
608
|
+
},
|
|
609
|
+
},
|
|
610
|
+
{
|
|
611
|
+
name: 'batch_delete_bitable_records',
|
|
612
|
+
description: '[Official API] Batch delete multiple records from a Bitable table. Max 500 per call.',
|
|
613
|
+
inputSchema: {
|
|
614
|
+
type: 'object',
|
|
615
|
+
properties: {
|
|
616
|
+
app_token: { type: 'string', description: 'Bitable app token' },
|
|
617
|
+
table_id: { type: 'string', description: 'Table ID' },
|
|
618
|
+
record_ids: { type: 'array', description: 'Array of record IDs to delete', items: { type: 'string' } },
|
|
619
|
+
},
|
|
620
|
+
required: ['app_token', 'table_id', 'record_ids'],
|
|
621
|
+
},
|
|
622
|
+
},
|
|
487
623
|
|
|
488
624
|
// ========== Wiki — Official API ==========
|
|
489
625
|
{
|
|
@@ -574,6 +710,384 @@ const TOOLS = [
|
|
|
574
710
|
},
|
|
575
711
|
},
|
|
576
712
|
},
|
|
713
|
+
|
|
714
|
+
// ========== IM — Bot Send / Edit / Delete ==========
|
|
715
|
+
{
|
|
716
|
+
name: 'send_message_as_bot',
|
|
717
|
+
description: '[Official API] Send a message as the bot to any chat. Supports text, post, interactive, etc.',
|
|
718
|
+
inputSchema: {
|
|
719
|
+
type: 'object',
|
|
720
|
+
properties: {
|
|
721
|
+
chat_id: { type: 'string', description: 'Target chat_id (oc_xxx) or open_id' },
|
|
722
|
+
msg_type: { type: 'string', description: 'Message type: text, post, image, interactive, etc.', enum: ['text', 'post', 'image', 'interactive', 'share_chat', 'share_user', 'audio', 'media', 'file', 'sticker'] },
|
|
723
|
+
content: { description: 'Message content (string or object, auto-serialized). For text: {"text":"hello"}' },
|
|
724
|
+
},
|
|
725
|
+
required: ['chat_id', 'msg_type', 'content'],
|
|
726
|
+
},
|
|
727
|
+
},
|
|
728
|
+
{
|
|
729
|
+
name: 'delete_message',
|
|
730
|
+
description: '[Official API] Recall/delete a message (bot can only delete its own messages).',
|
|
731
|
+
inputSchema: {
|
|
732
|
+
type: 'object',
|
|
733
|
+
properties: { message_id: { type: 'string', description: 'Message ID (om_xxx)' } },
|
|
734
|
+
required: ['message_id'],
|
|
735
|
+
},
|
|
736
|
+
},
|
|
737
|
+
{
|
|
738
|
+
name: 'update_message',
|
|
739
|
+
description: '[Official API] Edit a sent message (bot can only edit its own messages). Supports text and post.',
|
|
740
|
+
inputSchema: {
|
|
741
|
+
type: 'object',
|
|
742
|
+
properties: {
|
|
743
|
+
message_id: { type: 'string', description: 'Message ID (om_xxx)' },
|
|
744
|
+
msg_type: { type: 'string', description: 'Message type: text or post' },
|
|
745
|
+
content: { description: 'New content. For text: {"text":"updated text"}' },
|
|
746
|
+
},
|
|
747
|
+
required: ['message_id', 'msg_type', 'content'],
|
|
748
|
+
},
|
|
749
|
+
},
|
|
750
|
+
|
|
751
|
+
// ========== IM — Reactions ==========
|
|
752
|
+
{
|
|
753
|
+
name: 'add_reaction',
|
|
754
|
+
description: '[Official API] Add an emoji reaction to a message.',
|
|
755
|
+
inputSchema: {
|
|
756
|
+
type: 'object',
|
|
757
|
+
properties: {
|
|
758
|
+
message_id: { type: 'string', description: 'Message ID (om_xxx)' },
|
|
759
|
+
emoji_type: { type: 'string', description: 'Emoji type string, e.g. "THUMBSUP", "SMILE", "HEART"' },
|
|
760
|
+
},
|
|
761
|
+
required: ['message_id', 'emoji_type'],
|
|
762
|
+
},
|
|
763
|
+
},
|
|
764
|
+
{
|
|
765
|
+
name: 'delete_reaction',
|
|
766
|
+
description: '[Official API] Remove an emoji reaction from a message.',
|
|
767
|
+
inputSchema: {
|
|
768
|
+
type: 'object',
|
|
769
|
+
properties: {
|
|
770
|
+
message_id: { type: 'string', description: 'Message ID' },
|
|
771
|
+
reaction_id: { type: 'string', description: 'Reaction ID (from add_reaction response)' },
|
|
772
|
+
},
|
|
773
|
+
required: ['message_id', 'reaction_id'],
|
|
774
|
+
},
|
|
775
|
+
},
|
|
776
|
+
|
|
777
|
+
// ========== IM — Pin Messages ==========
|
|
778
|
+
{
|
|
779
|
+
name: 'pin_message',
|
|
780
|
+
description: '[Official API] Pin a message in a chat.',
|
|
781
|
+
inputSchema: {
|
|
782
|
+
type: 'object',
|
|
783
|
+
properties: { message_id: { type: 'string', description: 'Message ID to pin' } },
|
|
784
|
+
required: ['message_id'],
|
|
785
|
+
},
|
|
786
|
+
},
|
|
787
|
+
{
|
|
788
|
+
name: 'unpin_message',
|
|
789
|
+
description: '[Official API] Unpin a message from a chat.',
|
|
790
|
+
inputSchema: {
|
|
791
|
+
type: 'object',
|
|
792
|
+
properties: { message_id: { type: 'string', description: 'Message ID to unpin' } },
|
|
793
|
+
required: ['message_id'],
|
|
794
|
+
},
|
|
795
|
+
},
|
|
796
|
+
|
|
797
|
+
// ========== IM — Chat Management ==========
|
|
798
|
+
{
|
|
799
|
+
name: 'create_group',
|
|
800
|
+
description: '[Official API] Create a new group chat (as bot). Can add initial members.',
|
|
801
|
+
inputSchema: {
|
|
802
|
+
type: 'object',
|
|
803
|
+
properties: {
|
|
804
|
+
name: { type: 'string', description: 'Group name' },
|
|
805
|
+
description: { type: 'string', description: 'Group description (optional)' },
|
|
806
|
+
user_ids: { type: 'array', items: { type: 'string' }, description: 'Initial member open_ids (optional)' },
|
|
807
|
+
},
|
|
808
|
+
required: ['name'],
|
|
809
|
+
},
|
|
810
|
+
},
|
|
811
|
+
{
|
|
812
|
+
name: 'update_group',
|
|
813
|
+
description: '[Official API] Update group chat name or description.',
|
|
814
|
+
inputSchema: {
|
|
815
|
+
type: 'object',
|
|
816
|
+
properties: {
|
|
817
|
+
chat_id: { type: 'string', description: 'Chat ID (oc_xxx)' },
|
|
818
|
+
name: { type: 'string', description: 'New group name (optional)' },
|
|
819
|
+
description: { type: 'string', description: 'New description (optional)' },
|
|
820
|
+
},
|
|
821
|
+
required: ['chat_id'],
|
|
822
|
+
},
|
|
823
|
+
},
|
|
824
|
+
{
|
|
825
|
+
name: 'list_members',
|
|
826
|
+
description: '[Official API] List all members in a group chat.',
|
|
827
|
+
inputSchema: {
|
|
828
|
+
type: 'object',
|
|
829
|
+
properties: {
|
|
830
|
+
chat_id: { type: 'string', description: 'Chat ID (oc_xxx)' },
|
|
831
|
+
page_size: { type: 'number', description: 'Items per page (default 50)' },
|
|
832
|
+
page_token: { type: 'string', description: 'Pagination token' },
|
|
833
|
+
},
|
|
834
|
+
required: ['chat_id'],
|
|
835
|
+
},
|
|
836
|
+
},
|
|
837
|
+
{
|
|
838
|
+
name: 'add_members',
|
|
839
|
+
description: '[Official API] Add users to a group chat.',
|
|
840
|
+
inputSchema: {
|
|
841
|
+
type: 'object',
|
|
842
|
+
properties: {
|
|
843
|
+
chat_id: { type: 'string', description: 'Chat ID (oc_xxx)' },
|
|
844
|
+
user_ids: { type: 'array', items: { type: 'string' }, description: 'Array of user open_ids to add' },
|
|
845
|
+
},
|
|
846
|
+
required: ['chat_id', 'user_ids'],
|
|
847
|
+
},
|
|
848
|
+
},
|
|
849
|
+
{
|
|
850
|
+
name: 'remove_members',
|
|
851
|
+
description: '[Official API] Remove users from a group chat.',
|
|
852
|
+
inputSchema: {
|
|
853
|
+
type: 'object',
|
|
854
|
+
properties: {
|
|
855
|
+
chat_id: { type: 'string', description: 'Chat ID (oc_xxx)' },
|
|
856
|
+
user_ids: { type: 'array', items: { type: 'string' }, description: 'Array of user open_ids to remove' },
|
|
857
|
+
},
|
|
858
|
+
required: ['chat_id', 'user_ids'],
|
|
859
|
+
},
|
|
860
|
+
},
|
|
861
|
+
|
|
862
|
+
// ========== Docs — Block Editing ==========
|
|
863
|
+
{
|
|
864
|
+
name: 'create_doc_block',
|
|
865
|
+
description: '[Official API] Insert content blocks into a document. Add text, headings, lists, etc. after create_doc.',
|
|
866
|
+
inputSchema: {
|
|
867
|
+
type: 'object',
|
|
868
|
+
properties: {
|
|
869
|
+
document_id: { type: 'string', description: 'Document ID' },
|
|
870
|
+
parent_block_id: { type: 'string', description: 'Parent block ID (use document_id for root)' },
|
|
871
|
+
children: { type: 'array', description: 'Array of block objects to insert. E.g. [{block_type:2, text:{elements:[{text_run:{content:"Hello"}}]}}]', items: { type: 'object' } },
|
|
872
|
+
index: { type: 'number', description: 'Insert position (optional, appends to end if omitted)' },
|
|
873
|
+
},
|
|
874
|
+
required: ['document_id', 'parent_block_id', 'children'],
|
|
875
|
+
},
|
|
876
|
+
},
|
|
877
|
+
{
|
|
878
|
+
name: 'update_doc_block',
|
|
879
|
+
description: '[Official API] Update a specific block in a document (change text content, style, etc.).',
|
|
880
|
+
inputSchema: {
|
|
881
|
+
type: 'object',
|
|
882
|
+
properties: {
|
|
883
|
+
document_id: { type: 'string', description: 'Document ID' },
|
|
884
|
+
block_id: { type: 'string', description: 'Block ID to update' },
|
|
885
|
+
update_body: { type: 'object', description: 'Update payload. E.g. {update_text_elements:{elements:[{text_run:{content:"new text"}}]}}' },
|
|
886
|
+
},
|
|
887
|
+
required: ['document_id', 'block_id', 'update_body'],
|
|
888
|
+
},
|
|
889
|
+
},
|
|
890
|
+
{
|
|
891
|
+
name: 'delete_doc_blocks',
|
|
892
|
+
description: '[Official API] Delete a range of blocks from a document.',
|
|
893
|
+
inputSchema: {
|
|
894
|
+
type: 'object',
|
|
895
|
+
properties: {
|
|
896
|
+
document_id: { type: 'string', description: 'Document ID' },
|
|
897
|
+
parent_block_id: { type: 'string', description: 'Parent block ID containing the blocks to delete' },
|
|
898
|
+
start_index: { type: 'number', description: 'Start index (inclusive)' },
|
|
899
|
+
end_index: { type: 'number', description: 'End index (exclusive)' },
|
|
900
|
+
},
|
|
901
|
+
required: ['document_id', 'parent_block_id', 'start_index', 'end_index'],
|
|
902
|
+
},
|
|
903
|
+
},
|
|
904
|
+
|
|
905
|
+
// ========== Bitable — Additional ==========
|
|
906
|
+
{
|
|
907
|
+
name: 'get_bitable_record',
|
|
908
|
+
description: '[Official API] Get a single record by ID from a Bitable table.',
|
|
909
|
+
inputSchema: {
|
|
910
|
+
type: 'object',
|
|
911
|
+
properties: {
|
|
912
|
+
app_token: { type: 'string', description: 'Bitable app token' },
|
|
913
|
+
table_id: { type: 'string', description: 'Table ID' },
|
|
914
|
+
record_id: { type: 'string', description: 'Record ID' },
|
|
915
|
+
},
|
|
916
|
+
required: ['app_token', 'table_id', 'record_id'],
|
|
917
|
+
},
|
|
918
|
+
},
|
|
919
|
+
{
|
|
920
|
+
name: 'delete_bitable_table',
|
|
921
|
+
description: '[Official API] Delete a data table from a Bitable app.',
|
|
922
|
+
inputSchema: {
|
|
923
|
+
type: 'object',
|
|
924
|
+
properties: {
|
|
925
|
+
app_token: { type: 'string', description: 'Bitable app token' },
|
|
926
|
+
table_id: { type: 'string', description: 'Table ID to delete' },
|
|
927
|
+
},
|
|
928
|
+
required: ['app_token', 'table_id'],
|
|
929
|
+
},
|
|
930
|
+
},
|
|
931
|
+
|
|
932
|
+
// ========== Drive — File Operations ==========
|
|
933
|
+
{
|
|
934
|
+
name: 'copy_file',
|
|
935
|
+
description: '[Official API] Copy a file/doc in Drive.',
|
|
936
|
+
inputSchema: {
|
|
937
|
+
type: 'object',
|
|
938
|
+
properties: {
|
|
939
|
+
file_token: { type: 'string', description: 'File token to copy' },
|
|
940
|
+
name: { type: 'string', description: 'New file name' },
|
|
941
|
+
folder_token: { type: 'string', description: 'Destination folder token (optional)' },
|
|
942
|
+
type: { type: 'string', description: 'File type: file, doc, sheet, bitable, docx, mindnote, slides (optional)' },
|
|
943
|
+
},
|
|
944
|
+
required: ['file_token', 'name'],
|
|
945
|
+
},
|
|
946
|
+
},
|
|
947
|
+
{
|
|
948
|
+
name: 'move_file',
|
|
949
|
+
description: '[Official API] Move a file to another folder in Drive.',
|
|
950
|
+
inputSchema: {
|
|
951
|
+
type: 'object',
|
|
952
|
+
properties: {
|
|
953
|
+
file_token: { type: 'string', description: 'File token to move' },
|
|
954
|
+
folder_token: { type: 'string', description: 'Destination folder token' },
|
|
955
|
+
},
|
|
956
|
+
required: ['file_token', 'folder_token'],
|
|
957
|
+
},
|
|
958
|
+
},
|
|
959
|
+
{
|
|
960
|
+
name: 'delete_file',
|
|
961
|
+
description: '[Official API] Delete a file/folder from Drive.',
|
|
962
|
+
inputSchema: {
|
|
963
|
+
type: 'object',
|
|
964
|
+
properties: {
|
|
965
|
+
file_token: { type: 'string', description: 'File token to delete' },
|
|
966
|
+
type: { type: 'string', description: 'Type: file, folder, doc, sheet, bitable, docx, mindnote, slides' },
|
|
967
|
+
},
|
|
968
|
+
required: ['file_token'],
|
|
969
|
+
},
|
|
970
|
+
},
|
|
971
|
+
|
|
972
|
+
// ========== Calendar ==========
|
|
973
|
+
{
|
|
974
|
+
name: 'list_calendars',
|
|
975
|
+
description: '[Official API] List all calendars accessible by the bot.',
|
|
976
|
+
inputSchema: { type: 'object', properties: {} },
|
|
977
|
+
},
|
|
978
|
+
{
|
|
979
|
+
name: 'create_calendar_event',
|
|
980
|
+
description: '[Official API] Create a calendar event.',
|
|
981
|
+
inputSchema: {
|
|
982
|
+
type: 'object',
|
|
983
|
+
properties: {
|
|
984
|
+
calendar_id: { type: 'string', description: 'Calendar ID (from list_calendars)' },
|
|
985
|
+
summary: { type: 'string', description: 'Event title' },
|
|
986
|
+
start_time: { type: 'string', description: 'Start time (RFC3339 or Unix timestamp string)' },
|
|
987
|
+
end_time: { type: 'string', description: 'End time (RFC3339 or Unix timestamp string)' },
|
|
988
|
+
description: { type: 'string', description: 'Event description (optional)' },
|
|
989
|
+
location: { type: 'string', description: 'Event location (optional)' },
|
|
990
|
+
},
|
|
991
|
+
required: ['calendar_id', 'summary', 'start_time', 'end_time'],
|
|
992
|
+
},
|
|
993
|
+
},
|
|
994
|
+
{
|
|
995
|
+
name: 'list_calendar_events',
|
|
996
|
+
description: '[Official API] List events in a calendar.',
|
|
997
|
+
inputSchema: {
|
|
998
|
+
type: 'object',
|
|
999
|
+
properties: {
|
|
1000
|
+
calendar_id: { type: 'string', description: 'Calendar ID' },
|
|
1001
|
+
start_time: { type: 'string', description: 'Start time filter (Unix timestamp string, optional)' },
|
|
1002
|
+
end_time: { type: 'string', description: 'End time filter (Unix timestamp string, optional)' },
|
|
1003
|
+
page_size: { type: 'number', description: 'Items per page (default 50)' },
|
|
1004
|
+
},
|
|
1005
|
+
required: ['calendar_id'],
|
|
1006
|
+
},
|
|
1007
|
+
},
|
|
1008
|
+
{
|
|
1009
|
+
name: 'delete_calendar_event',
|
|
1010
|
+
description: '[Official API] Delete a calendar event.',
|
|
1011
|
+
inputSchema: {
|
|
1012
|
+
type: 'object',
|
|
1013
|
+
properties: {
|
|
1014
|
+
calendar_id: { type: 'string', description: 'Calendar ID' },
|
|
1015
|
+
event_id: { type: 'string', description: 'Event ID to delete' },
|
|
1016
|
+
},
|
|
1017
|
+
required: ['calendar_id', 'event_id'],
|
|
1018
|
+
},
|
|
1019
|
+
},
|
|
1020
|
+
{
|
|
1021
|
+
name: 'get_freebusy',
|
|
1022
|
+
description: '[Official API] Check free/busy status of users for a time range.',
|
|
1023
|
+
inputSchema: {
|
|
1024
|
+
type: 'object',
|
|
1025
|
+
properties: {
|
|
1026
|
+
user_ids: { type: 'array', items: { type: 'string' }, description: 'Array of user open_ids to check' },
|
|
1027
|
+
start_time: { type: 'string', description: 'Range start (RFC3339)' },
|
|
1028
|
+
end_time: { type: 'string', description: 'Range end (RFC3339)' },
|
|
1029
|
+
},
|
|
1030
|
+
required: ['user_ids', 'start_time', 'end_time'],
|
|
1031
|
+
},
|
|
1032
|
+
},
|
|
1033
|
+
|
|
1034
|
+
// ========== Tasks ==========
|
|
1035
|
+
{
|
|
1036
|
+
name: 'create_task',
|
|
1037
|
+
description: '[Official API] Create a new task in Feishu Tasks.',
|
|
1038
|
+
inputSchema: {
|
|
1039
|
+
type: 'object',
|
|
1040
|
+
properties: {
|
|
1041
|
+
summary: { type: 'string', description: 'Task title/summary' },
|
|
1042
|
+
description: { type: 'string', description: 'Task description (optional)' },
|
|
1043
|
+
due: { type: 'string', description: 'Due date/time (RFC3339 or Unix timestamp string, optional)' },
|
|
1044
|
+
},
|
|
1045
|
+
required: ['summary'],
|
|
1046
|
+
},
|
|
1047
|
+
},
|
|
1048
|
+
{
|
|
1049
|
+
name: 'get_task',
|
|
1050
|
+
description: '[Official API] Get task details by ID.',
|
|
1051
|
+
inputSchema: {
|
|
1052
|
+
type: 'object',
|
|
1053
|
+
properties: { task_id: { type: 'string', description: 'Task ID' } },
|
|
1054
|
+
required: ['task_id'],
|
|
1055
|
+
},
|
|
1056
|
+
},
|
|
1057
|
+
{
|
|
1058
|
+
name: 'list_tasks',
|
|
1059
|
+
description: '[Official API] List tasks.',
|
|
1060
|
+
inputSchema: {
|
|
1061
|
+
type: 'object',
|
|
1062
|
+
properties: {
|
|
1063
|
+
page_size: { type: 'number', description: 'Items per page (default 50)' },
|
|
1064
|
+
page_token: { type: 'string', description: 'Pagination token' },
|
|
1065
|
+
},
|
|
1066
|
+
},
|
|
1067
|
+
},
|
|
1068
|
+
{
|
|
1069
|
+
name: 'update_task',
|
|
1070
|
+
description: '[Official API] Update a task (title, description, due date, etc.).',
|
|
1071
|
+
inputSchema: {
|
|
1072
|
+
type: 'object',
|
|
1073
|
+
properties: {
|
|
1074
|
+
task_id: { type: 'string', description: 'Task ID' },
|
|
1075
|
+
summary: { type: 'string', description: 'New title (optional)' },
|
|
1076
|
+
description: { type: 'string', description: 'New description (optional)' },
|
|
1077
|
+
due: { type: 'string', description: 'New due date (optional)' },
|
|
1078
|
+
},
|
|
1079
|
+
required: ['task_id'],
|
|
1080
|
+
},
|
|
1081
|
+
},
|
|
1082
|
+
{
|
|
1083
|
+
name: 'complete_task',
|
|
1084
|
+
description: '[Official API] Mark a task as complete.',
|
|
1085
|
+
inputSchema: {
|
|
1086
|
+
type: 'object',
|
|
1087
|
+
properties: { task_id: { type: 'string', description: 'Task ID to complete' } },
|
|
1088
|
+
required: ['task_id'],
|
|
1089
|
+
},
|
|
1090
|
+
},
|
|
577
1091
|
];
|
|
578
1092
|
|
|
579
1093
|
// --- Server ---
|
|
@@ -677,9 +1191,24 @@ async function handleTool(name, args) {
|
|
|
677
1191
|
return text(chatId ? `P2P chat: ${chatId}` : 'Failed to create P2P chat');
|
|
678
1192
|
}
|
|
679
1193
|
case 'get_chat_info': {
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
1194
|
+
// Strategy 1: Official API im.chat.get (supports oc_xxx format)
|
|
1195
|
+
if (args.chat_id.startsWith('oc_')) {
|
|
1196
|
+
try {
|
|
1197
|
+
const info = await getOfficialClient().getChatInfo(args.chat_id);
|
|
1198
|
+
return info ? json(info) : text(`No info for chat ${args.chat_id}`);
|
|
1199
|
+
} catch (e) {
|
|
1200
|
+
console.error(`[feishu-user-plugin] Official getChatInfo failed: ${e.message}`);
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1203
|
+
// Strategy 2: Protobuf gateway (supports numeric chat_id)
|
|
1204
|
+
try {
|
|
1205
|
+
const c = await getUserClient();
|
|
1206
|
+
const info = await c.getGroupInfo(args.chat_id);
|
|
1207
|
+
if (info) return json(info);
|
|
1208
|
+
} catch (e) {
|
|
1209
|
+
console.error(`[feishu-user-plugin] Protobuf getChatInfo failed: ${e.message}`);
|
|
1210
|
+
}
|
|
1211
|
+
return text(`No info for chat ${args.chat_id}`);
|
|
683
1212
|
}
|
|
684
1213
|
case 'get_user_info': {
|
|
685
1214
|
let n = null;
|
|
@@ -807,10 +1336,34 @@ async function handleTool(name, args) {
|
|
|
807
1336
|
|
|
808
1337
|
// --- Official API: Bitable ---
|
|
809
1338
|
|
|
1339
|
+
case 'create_bitable': {
|
|
1340
|
+
const r = await getOfficialClient().createBitable(args.name, args.folder_id);
|
|
1341
|
+
return text(`Bitable created: ${r.appToken}${r.url ? `\nURL: ${r.url}` : ''}`);
|
|
1342
|
+
}
|
|
810
1343
|
case 'list_bitable_tables':
|
|
811
1344
|
return json(await getOfficialClient().listBitableTables(args.app_token));
|
|
1345
|
+
case 'create_bitable_table':
|
|
1346
|
+
return text(`Table created: ${(await getOfficialClient().createBitableTable(args.app_token, args.name, args.fields)).tableId}`);
|
|
812
1347
|
case 'list_bitable_fields':
|
|
813
1348
|
return json(await getOfficialClient().listBitableFields(args.app_token, args.table_id));
|
|
1349
|
+
case 'create_bitable_field': {
|
|
1350
|
+
const config = { field_name: args.field_name, type: args.type };
|
|
1351
|
+
if (args.property) config.property = args.property;
|
|
1352
|
+
return json(await getOfficialClient().createBitableField(args.app_token, args.table_id, config));
|
|
1353
|
+
}
|
|
1354
|
+
case 'update_bitable_field': {
|
|
1355
|
+
const config = {};
|
|
1356
|
+
if (args.field_name) config.field_name = args.field_name;
|
|
1357
|
+
if (args.type) config.type = args.type;
|
|
1358
|
+
if (args.property) config.property = args.property;
|
|
1359
|
+
return json(await getOfficialClient().updateBitableField(args.app_token, args.table_id, args.field_id, config));
|
|
1360
|
+
}
|
|
1361
|
+
case 'delete_bitable_field': {
|
|
1362
|
+
const r = await getOfficialClient().deleteBitableField(args.app_token, args.table_id, args.field_id);
|
|
1363
|
+
return text(r.deleted ? `Field ${r.fieldId} deleted` : `Field deletion returned deleted=${r.deleted}`);
|
|
1364
|
+
}
|
|
1365
|
+
case 'list_bitable_views':
|
|
1366
|
+
return json(await getOfficialClient().listBitableViews(args.app_token, args.table_id));
|
|
814
1367
|
case 'search_bitable_records':
|
|
815
1368
|
return json(await getOfficialClient().searchBitableRecords(args.app_token, args.table_id, {
|
|
816
1369
|
filter: args.filter, sort: args.sort, pageSize: args.page_size,
|
|
@@ -819,6 +1372,14 @@ async function handleTool(name, args) {
|
|
|
819
1372
|
return text(`Record created: ${(await getOfficialClient().createBitableRecord(args.app_token, args.table_id, args.fields)).recordId}`);
|
|
820
1373
|
case 'update_bitable_record':
|
|
821
1374
|
return text(`Record updated: ${(await getOfficialClient().updateBitableRecord(args.app_token, args.table_id, args.record_id, args.fields)).recordId}`);
|
|
1375
|
+
case 'delete_bitable_record':
|
|
1376
|
+
return text(`Record deleted: ${(await getOfficialClient().deleteBitableRecord(args.app_token, args.table_id, args.record_id)).deleted}`);
|
|
1377
|
+
case 'batch_create_bitable_records':
|
|
1378
|
+
return json(await getOfficialClient().batchCreateBitableRecords(args.app_token, args.table_id, args.records));
|
|
1379
|
+
case 'batch_update_bitable_records':
|
|
1380
|
+
return json(await getOfficialClient().batchUpdateBitableRecords(args.app_token, args.table_id, args.records));
|
|
1381
|
+
case 'batch_delete_bitable_records':
|
|
1382
|
+
return json(await getOfficialClient().batchDeleteBitableRecords(args.app_token, args.table_id, args.record_ids));
|
|
822
1383
|
|
|
823
1384
|
// --- Official API: Wiki ---
|
|
824
1385
|
|
|
@@ -852,6 +1413,115 @@ async function handleTool(name, args) {
|
|
|
852
1413
|
return text(`File uploaded: ${r.fileKey}\nUse this file_key with send_file_as_user to send it.`);
|
|
853
1414
|
}
|
|
854
1415
|
|
|
1416
|
+
// --- Official API: Bot Send / Edit / Delete ---
|
|
1417
|
+
|
|
1418
|
+
case 'send_message_as_bot': {
|
|
1419
|
+
const r = await getOfficialClient().sendMessageAsBot(args.chat_id, args.msg_type, args.content);
|
|
1420
|
+
return text(`Message sent (bot): ${r.messageId}`);
|
|
1421
|
+
}
|
|
1422
|
+
case 'delete_message':
|
|
1423
|
+
return text(`Message deleted: ${(await getOfficialClient().deleteMessage(args.message_id)).deleted}`);
|
|
1424
|
+
case 'update_message':
|
|
1425
|
+
return text(`Message updated: ${(await getOfficialClient().updateMessage(args.message_id, args.msg_type, args.content)).messageId}`);
|
|
1426
|
+
|
|
1427
|
+
// --- Official API: Reactions ---
|
|
1428
|
+
|
|
1429
|
+
case 'add_reaction':
|
|
1430
|
+
return text(`Reaction added: ${(await getOfficialClient().addReaction(args.message_id, args.emoji_type)).reactionId}`);
|
|
1431
|
+
case 'delete_reaction':
|
|
1432
|
+
return text(`Reaction removed: ${(await getOfficialClient().deleteReaction(args.message_id, args.reaction_id)).deleted}`);
|
|
1433
|
+
|
|
1434
|
+
// --- Official API: Pins ---
|
|
1435
|
+
|
|
1436
|
+
case 'pin_message':
|
|
1437
|
+
return json(await getOfficialClient().pinMessage(args.message_id));
|
|
1438
|
+
case 'unpin_message':
|
|
1439
|
+
return text(`Unpinned: ${(await getOfficialClient().unpinMessage(args.message_id)).deleted}`);
|
|
1440
|
+
|
|
1441
|
+
// --- Official API: Chat Management ---
|
|
1442
|
+
|
|
1443
|
+
case 'create_group':
|
|
1444
|
+
return text(`Group created: ${(await getOfficialClient().createChat({ name: args.name, description: args.description, userIds: args.user_ids })).chatId}`);
|
|
1445
|
+
case 'update_group':
|
|
1446
|
+
return text(`Group updated: ${(await getOfficialClient().updateChat(args.chat_id, { name: args.name, description: args.description })).updated}`);
|
|
1447
|
+
case 'list_members':
|
|
1448
|
+
return json(await getOfficialClient().listChatMembers(args.chat_id, { pageSize: args.page_size, pageToken: args.page_token }));
|
|
1449
|
+
case 'add_members': {
|
|
1450
|
+
const r = await getOfficialClient().addChatMembers(args.chat_id, args.user_ids);
|
|
1451
|
+
return text(r.invalidIds.length ? `Added (invalid IDs: ${r.invalidIds.join(', ')})` : 'Members added');
|
|
1452
|
+
}
|
|
1453
|
+
case 'remove_members': {
|
|
1454
|
+
const r = await getOfficialClient().removeChatMembers(args.chat_id, args.user_ids);
|
|
1455
|
+
return text(r.invalidIds.length ? `Removed (invalid IDs: ${r.invalidIds.join(', ')})` : 'Members removed');
|
|
1456
|
+
}
|
|
1457
|
+
|
|
1458
|
+
// --- Official API: Doc Block Editing ---
|
|
1459
|
+
|
|
1460
|
+
case 'create_doc_block':
|
|
1461
|
+
return json(await getOfficialClient().createDocBlock(args.document_id, args.parent_block_id, args.children, args.index));
|
|
1462
|
+
case 'update_doc_block':
|
|
1463
|
+
return json(await getOfficialClient().updateDocBlock(args.document_id, args.block_id, args.update_body));
|
|
1464
|
+
case 'delete_doc_blocks':
|
|
1465
|
+
return text(`Blocks deleted: ${(await getOfficialClient().deleteDocBlocks(args.document_id, args.parent_block_id, args.start_index, args.end_index)).deleted}`);
|
|
1466
|
+
|
|
1467
|
+
// --- Official API: Bitable Additional ---
|
|
1468
|
+
|
|
1469
|
+
case 'get_bitable_record':
|
|
1470
|
+
return json(await getOfficialClient().getBitableRecord(args.app_token, args.table_id, args.record_id));
|
|
1471
|
+
case 'delete_bitable_table':
|
|
1472
|
+
return text(`Table deleted: ${(await getOfficialClient().deleteBitableTable(args.app_token, args.table_id)).deleted}`);
|
|
1473
|
+
|
|
1474
|
+
// --- Official API: Drive File Operations ---
|
|
1475
|
+
|
|
1476
|
+
case 'copy_file':
|
|
1477
|
+
return json(await getOfficialClient().copyFile(args.file_token, args.name, args.folder_token, args.type));
|
|
1478
|
+
case 'move_file':
|
|
1479
|
+
return text(`File moved: task=${(await getOfficialClient().moveFile(args.file_token, args.folder_token)).taskId}`);
|
|
1480
|
+
case 'delete_file':
|
|
1481
|
+
return text(`File deleted: task=${(await getOfficialClient().deleteFile(args.file_token, args.type)).taskId}`);
|
|
1482
|
+
|
|
1483
|
+
// --- Official API: Calendar ---
|
|
1484
|
+
|
|
1485
|
+
case 'list_calendars':
|
|
1486
|
+
return json(await getOfficialClient().listCalendars());
|
|
1487
|
+
case 'create_calendar_event': {
|
|
1488
|
+
const event = { summary: args.summary, description: args.description || '' };
|
|
1489
|
+
event.start_time = { timestamp: args.start_time };
|
|
1490
|
+
event.end_time = { timestamp: args.end_time };
|
|
1491
|
+
if (args.location) event.location = { name: args.location };
|
|
1492
|
+
return json(await getOfficialClient().createCalendarEvent(args.calendar_id, event));
|
|
1493
|
+
}
|
|
1494
|
+
case 'list_calendar_events':
|
|
1495
|
+
return json(await getOfficialClient().listCalendarEvents(args.calendar_id, {
|
|
1496
|
+
startTime: args.start_time, endTime: args.end_time, pageSize: args.page_size,
|
|
1497
|
+
}));
|
|
1498
|
+
case 'delete_calendar_event':
|
|
1499
|
+
return text(`Event deleted: ${(await getOfficialClient().deleteCalendarEvent(args.calendar_id, args.event_id)).deleted}`);
|
|
1500
|
+
case 'get_freebusy':
|
|
1501
|
+
return json(await getOfficialClient().getFreeBusy(args.user_ids, args.start_time, args.end_time));
|
|
1502
|
+
|
|
1503
|
+
// --- Official API: Tasks ---
|
|
1504
|
+
|
|
1505
|
+
case 'create_task': {
|
|
1506
|
+
const task = { summary: args.summary };
|
|
1507
|
+
if (args.description) task.description = args.description;
|
|
1508
|
+
if (args.due) task.due = { timestamp: args.due };
|
|
1509
|
+
return json(await getOfficialClient().createTask(task));
|
|
1510
|
+
}
|
|
1511
|
+
case 'get_task':
|
|
1512
|
+
return json(await getOfficialClient().getTask(args.task_id));
|
|
1513
|
+
case 'list_tasks':
|
|
1514
|
+
return json(await getOfficialClient().listTasks({ pageSize: args.page_size, pageToken: args.page_token }));
|
|
1515
|
+
case 'update_task': {
|
|
1516
|
+
const task = {};
|
|
1517
|
+
if (args.summary) task.summary = args.summary;
|
|
1518
|
+
if (args.description) task.description = args.description;
|
|
1519
|
+
if (args.due) task.due = { timestamp: args.due };
|
|
1520
|
+
return json(await getOfficialClient().updateTask(args.task_id, task));
|
|
1521
|
+
}
|
|
1522
|
+
case 'complete_task':
|
|
1523
|
+
return text(`Task completed: ${(await getOfficialClient().completeTask(args.task_id)).completed}`);
|
|
1524
|
+
|
|
855
1525
|
default:
|
|
856
1526
|
return text(`Unknown tool: ${name}`);
|
|
857
1527
|
}
|