mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-31 03:13:55 +08:00
从json中加载默认工具,方便自定义tools
This commit is contained in:
@@ -0,0 +1,72 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "self.get_device_status",
|
||||||
|
"description": "Provides the real-time information of the device, including the current status of the audio speaker, screen, battery, network, etc.\nUse this tool for: \n1. Answering questions about current condition (e.g. what is the current volume of the audio speaker?)\n2. As the first step to control the device (e.g. turn up / down the volume of the audio speaker, etc.)",
|
||||||
|
"inputSchema": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {}
|
||||||
|
},
|
||||||
|
"mockResponse": {
|
||||||
|
"audio_speaker": {
|
||||||
|
"volume": 50,
|
||||||
|
"muted": false
|
||||||
|
},
|
||||||
|
"screen": {
|
||||||
|
"brightness": 80,
|
||||||
|
"theme": "light"
|
||||||
|
},
|
||||||
|
"battery": {
|
||||||
|
"level": 85,
|
||||||
|
"charging": false
|
||||||
|
},
|
||||||
|
"network": {
|
||||||
|
"connected": true,
|
||||||
|
"type": "wifi"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "self.audio_speaker.set_volume",
|
||||||
|
"description": "Set the volume of the audio speaker. If the current volume is unknown, you must call `self.get_device_status` tool first and then call this tool.",
|
||||||
|
"inputSchema": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"volume": {
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 0,
|
||||||
|
"maximum": 100
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"volume"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"mockResponse": {
|
||||||
|
"success": true,
|
||||||
|
"volume": "${volume}",
|
||||||
|
"message": "音量已设置为 ${volume}"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "self.screen.set_brightness",
|
||||||
|
"description": "Set the brightness of the screen.",
|
||||||
|
"inputSchema": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"brightness": {
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 0,
|
||||||
|
"maximum": 100
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"brightness"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"mockResponse": {
|
||||||
|
"success": true,
|
||||||
|
"brightness": "${brightness}",
|
||||||
|
"message": "亮度已设置为 ${brightness}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -1794,62 +1794,7 @@
|
|||||||
// ==========================================
|
// ==========================================
|
||||||
|
|
||||||
// 默认工具数据
|
// 默认工具数据
|
||||||
const defaultMcpTools = [
|
const defaultMcpTools = await fetch("default-mcp-tools.json").then(res => res.json());
|
||||||
{
|
|
||||||
name: "self.get_device_status",
|
|
||||||
description: "Provides the real-time information of the device, including the current status of the audio speaker, screen, battery, network, etc.\nUse this tool for: \n1. Answering questions about current condition (e.g. what is the current volume of the audio speaker?)\n2. As the first step to control the device (e.g. turn up / down the volume of the audio speaker, etc.)",
|
|
||||||
inputSchema: {
|
|
||||||
type: "object",
|
|
||||||
properties: {}
|
|
||||||
},
|
|
||||||
mockResponse: {
|
|
||||||
audio_speaker: { volume: 50, muted: false },
|
|
||||||
screen: { brightness: 80, theme: 'light' },
|
|
||||||
battery: { level: 85, charging: false },
|
|
||||||
network: { connected: true, type: 'wifi' }
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "self.audio_speaker.set_volume",
|
|
||||||
description: "Set the volume of the audio speaker. If the current volume is unknown, you must call `self.get_device_status` tool first and then call this tool.",
|
|
||||||
inputSchema: {
|
|
||||||
type: "object",
|
|
||||||
properties: {
|
|
||||||
volume: {
|
|
||||||
type: "integer",
|
|
||||||
minimum: 0,
|
|
||||||
maximum: 100
|
|
||||||
}
|
|
||||||
},
|
|
||||||
required: ["volume"]
|
|
||||||
},
|
|
||||||
mockResponse: {
|
|
||||||
success: true,
|
|
||||||
volume: "${volume}",
|
|
||||||
message: "音量已设置为 ${volume}"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "self.screen.set_brightness",
|
|
||||||
description: "Set the brightness of the screen.",
|
|
||||||
inputSchema: {
|
|
||||||
type: "object",
|
|
||||||
properties: {
|
|
||||||
brightness: {
|
|
||||||
type: "integer",
|
|
||||||
minimum: 0,
|
|
||||||
maximum: 100
|
|
||||||
}
|
|
||||||
},
|
|
||||||
required: ["brightness"]
|
|
||||||
},
|
|
||||||
mockResponse: {
|
|
||||||
success: true,
|
|
||||||
brightness: "${brightness}",
|
|
||||||
message: "亮度已设置为 ${brightness}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
// 全局变量
|
// 全局变量
|
||||||
let mcpTools = [];
|
let mcpTools = [];
|
||||||
|
|||||||
Reference in New Issue
Block a user