schemas.py
5.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
"""Tool schemas for Hermes Feishu plugin.
Defines the JSON schemas that the LLM uses to decide when and how
to invoke the feishu card/table tools.
"""
SEND_FEISHU_CARD_SCHEMA = {
"name": "send_feishu_card",
"description": (
"Send a rich card message to the current Feishu chat. "
"Use this when you need to display tabular data, structured content, "
"or formatted information that requires rich rendering. "
"The card supports Markdown text, tables (parsed from Markdown table syntax), "
"and interactive elements. "
"IMPORTANT: Feishu post messages do NOT support Markdown tables. "
"If your response contains a table (| col | col | format), "
"you MUST use this tool to render it properly."
),
"parameters": {
"type": "object",
"properties": {
"content": {
"type": "string",
"description": (
"Markdown content for the card. If it contains Markdown table "
"syntax (| col1 | col2 |\\n| --- | --- |\\n| data | data |), "
"the table will be automatically rendered using Feishu's Table "
"component. Non-table content is rendered as Markdown text."
),
},
"title": {
"type": "string",
"description": (
"Card header title. If not provided, defaults to '📊 数据表格' "
"when content contains tables, or no title for text-only cards."
),
"default": "",
},
"chat_id": {
"type": "string",
"description": (
"Feishu chat ID to send to. Usually provided automatically "
"via context. Only specify if you need to send to a different chat."
),
"default": "",
},
"template": {
"type": "string",
"description": (
"Card header color template. Options: blue, wathet, turquoise, "
"green, yellow, orange, red, carmine, violet, purple, indigo, grey."
),
"default": "blue",
"enum": [
"blue", "wathet", "turquoise", "green", "yellow",
"orange", "red", "carmine", "violet", "purple",
"indigo", "grey",
],
},
"reaction": {
"type": "string",
"description": (
"Optional Feishu emoji_type to add as reaction after sending. "
"Default: 'DONE' (✅). Common values: 'DONE', 'OK', 'THUMBSUP', 'CLAP'. "
"Pass empty string '' to skip reaction. "
"See: https://open.feishu.cn/document/server-docs/im-v1/message-reaction/emojis-introduce"
),
"default": "DONE",
},
},
"required": ["content"],
},
}
SEND_FEISHU_TABLE_SCHEMA = {
"name": "send_feishu_table",
"description": (
"Send a structured table as a Feishu card message. "
"Use this when you have tabular data in a structured format. "
"The table will be rendered using Feishu's Table component with proper "
"column types (text/number auto-detected). "
"Prefer this tool over send_feishu_card when you have structured data "
"rather than Markdown text."
),
"parameters": {
"type": "object",
"properties": {
"headers": {
"type": "array",
"items": {"type": "string"},
"description": "Column header names.",
},
"rows": {
"type": "array",
"items": {
"type": "array",
"items": {"type": "string"},
},
"description": "Table data rows. Each row is an array of cell values (strings).",
},
"title": {
"type": "string",
"description": "Card header title. Defaults to '📊 数据表格'.",
"default": "",
},
"chat_id": {
"type": "string",
"description": (
"Feishu chat ID. Usually auto-detected from context."
),
"default": "",
},
"template": {
"type": "string",
"description": "Card header color. Default: blue.",
"default": "blue",
"enum": [
"blue", "wathet", "turquoise", "green", "yellow",
"orange", "red", "carmine", "violet", "purple",
"indigo", "grey",
],
},
"reaction": {
"type": "string",
"description": (
"Optional Feishu emoji_type to add as reaction after sending. "
"Default: 'DONE' (✅). Common values: 'DONE', 'OK', 'THUMBSUP', 'CLAP'. "
"Pass empty string '' to skip reaction. "
"See: https://open.feishu.cn/document/server-docs/im-v1/message-reaction/emojis-introduce"
),
"default": "DONE",
},
},
"required": ["headers", "rows"],
},
}