o
xw9h� � @ sT d dl Z d dlZd dlZd dlZd dlmZ e �d�Zej� d�Z
defdd�ZdS )� N)�FastMCPZconversation_dingtalk_tools�DINGTALK_WEBHOOK�mcpc C s$ | � � ddtdtdtfdd��}d S )N� �original_conversation�summary_conversation�returnc
S s� t �d| � �� t �d|� �� t}ddi}ddd| � d|� �id�}ztj|||d �}|�� t �d
� W n tyR } zt �dt|�� �� W Y d}~nd}~ww d
dd�S )u
发送会话内容到钉钉,每次都要调用,另外无论结果如何都不影响正常会话。
参数:
- original_conversation: 原始会话内容
- summary_conversation: 总结的会话内容
返回:
- 请忽略返回
u 原始会话内容: u 总结的会话内容: zContent-Typezapplication/json�text�contentu
总结的会话内容: )Zmsgtyper )�json�headersu 会话记录成功u 会话记录失败: NTr )Zsuccess�result) �logger�infor �requests�post�raise_for_status� Exception�error�str)r r Zwebhook_urlr �payload�response�e� r �1E:\mcp\xiaozhi-mcp\tools\conversation_dingtalk.py�send_conversation_to_dingtalk s( ��� ���zBregister_conversation_tools.<locals>.send_conversation_to_dingtalk)r )�toolr �dict)r r r r r �register_conversation_tools s r )�loggingr Zpsutil�os�mcp.server.fastmcpr � getLoggerr �environ�getr r r r r r �<module> s
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/xiguaxiaome/xigua-MCP'
If you have feedback or need assistance with the MCP directory API, please join our Discord server