From 3b881bf8c8db39b217f2e253a7a1a52b5c2af80d Mon Sep 17 00:00:00 2001
From: tanjianbin <632190820@qq.com>
Date: Fri, 3 Apr 2026 15:55:23 +0800
Subject: [PATCH] =?UTF-8?q?feat(temi=5Fmcp):=20=E6=B7=BB=E5=8A=A0=E8=B7=B3?=
=?UTF-8?q?=E8=88=9E=E5=B7=A5=E5=85=B7=E5=B9=B6=E4=BF=AE=E5=A4=8D=E5=8D=A1?=
=?UTF-8?q?=E7=89=87=E6=B6=88=E6=81=AF=E5=8F=91=E9=80=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
为轮足机器人添加跳舞功能,包含新的 MCP 工具和服务器方法。同时修复 Lark MCP 中发送卡片消息时 person_id 处理的问题,避免在 person_id 为 None 时产生异常。更新两个包的版本号以反映变更。
---
lzwcai_lark_mcp/lzwcai_lark_mcp/tools.py | 8 +++++---
lzwcai_lark_mcp/pyproject.toml | 2 +-
lzwcai_temi_mcp/lzwcai_temi_mcp/main.py | 13 ++++++++++++-
lzwcai_temi_mcp/lzwcai_temi_mcp/nav_server.py | 12 +++++++++++-
lzwcai_temi_mcp/pyproject.toml | 2 +-
5 files changed, 30 insertions(+), 7 deletions(-)
diff --git a/lzwcai_lark_mcp/lzwcai_lark_mcp/tools.py b/lzwcai_lark_mcp/lzwcai_lark_mcp/tools.py
index 78a2b55..27f260c 100644
--- a/lzwcai_lark_mcp/lzwcai_lark_mcp/tools.py
+++ b/lzwcai_lark_mcp/lzwcai_lark_mcp/tools.py
@@ -1618,8 +1618,9 @@ def send_card_message(token: str, receiver_id: str, person_id: str, image_key: s
cst_now = utc_now + timedelta(hours=8)
current_time = cst_now.strftime("%Y-%m-%d %H:%M:%S")
- if person_id:
- person_content = f""
+ normalized_person_id = str(person_id).strip() if person_id is not None else ""
+ if normalized_person_id:
+ person_content = f""
else:
person_content = "未知用户"
@@ -1803,7 +1804,8 @@ async def handle_call_tool(name: str, arguments: Dict[str, object], token: str)
elif name == "send_card_message":
image_key = str(arguments.get("image_key", "")).strip()
receiver_id = str(arguments.get("receiver_id", "")).strip()
- person_id = str(arguments.get("person_id", "")).strip()
+ raw_person_id = arguments.get("person_id")
+ person_id = str(raw_person_id).strip() if raw_person_id is not None else ""
if not receiver_id:
raise ValueError("missing receiver_id")
if not image_key:
diff --git a/lzwcai_lark_mcp/pyproject.toml b/lzwcai_lark_mcp/pyproject.toml
index e9bbda5..79ee0d0 100644
--- a/lzwcai_lark_mcp/pyproject.toml
+++ b/lzwcai_lark_mcp/pyproject.toml
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
[project]
name = "lzwcai-lark-mcp"
-version = "0.1.13"
+version = "0.1.15"
description = "Lark MCP server"
requires-python = ">=3.10"
dependencies = [
diff --git a/lzwcai_temi_mcp/lzwcai_temi_mcp/main.py b/lzwcai_temi_mcp/lzwcai_temi_mcp/main.py
index 2a66f18..4e2dc67 100644
--- a/lzwcai_temi_mcp/lzwcai_temi_mcp/main.py
+++ b/lzwcai_temi_mcp/lzwcai_temi_mcp/main.py
@@ -145,7 +145,16 @@ async def serve() -> None:
},
"required": []
}
- )
+ ),
+ Tool(
+ name="dance",
+ description="轮足机器人跳舞",
+ inputSchema={
+ "type": "object",
+ "properties": {},
+ "required": []
+ }
+ ),
]
@server.call_tool()
@@ -186,6 +195,8 @@ async def serve() -> None:
)
elif name == "repose":
result = await nav_server.repose()
+ elif name == "dance":
+ result = await nav_server.dance()
elif name == "patrol":
locations = arguments.get("locations", [])
flag = arguments.get("flag", True if not locations else False)
diff --git a/lzwcai_temi_mcp/lzwcai_temi_mcp/nav_server.py b/lzwcai_temi_mcp/lzwcai_temi_mcp/nav_server.py
index af94411..00ab91a 100644
--- a/lzwcai_temi_mcp/lzwcai_temi_mcp/nav_server.py
+++ b/lzwcai_temi_mcp/lzwcai_temi_mcp/nav_server.py
@@ -117,9 +117,19 @@ class NavServer:
except Exception as e:
logger.error(f"Failed to call repose mcp-tool: {str(e)} ", exc_info=True)
return f"Failed to call repose mcp-tool: {str(e)}"
+
+ async def dance(self):
+ """轮足机器人跳舞"""
+ try:
+ params = {}
+ return await self.pub_cmd("temi-test", "dance", params)
+ except Exception as e:
+ logger.error(f"Failed to call dance mcp-tool: {str(e)} ", exc_info=True)
+ return f"Failed to call dance mcp-tool: {str(e)}"
+
async def patrol(self, locations: list = None, flag: bool = False):
- """轮足机器人巡逻 why !!! """
+ """轮足机器人巡逻 """
try:
params = {
"flag": True,
diff --git a/lzwcai_temi_mcp/pyproject.toml b/lzwcai_temi_mcp/pyproject.toml
index d2dda44..d36949e 100644
--- a/lzwcai_temi_mcp/pyproject.toml
+++ b/lzwcai_temi_mcp/pyproject.toml
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
[project]
name = "lzwcai_temi_mcp"
-version = "0.1.9"
+version = "0.1.12"
description = "MQTT-based navigation server for robot"
requires-python = ">=3.10"
dependencies = [