get_message_platforms
Retrieve configured messaging platforms from AstrBot to manage bot communication channels and integration settings.
Instructions
获取 AstrBot 中配置的消息平台列表,对应 /api/config/platform/list。
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- astrbot_mcp/tools/platform_tools.py:9-34 (handler)The core asynchronous handler function implementing the 'get_message_platforms' tool. It connects to AstrBot via AstrBotClient, fetches the platform list from /api/config/platform/list, handles errors, and returns the platforms list or error details.async def get_message_platforms() -> Dict[str, Any]: """ 获取 AstrBot 中配置的消息平台列表,对应 /api/config/platform/list。 """ client = AstrBotClient.from_env() try: result = await client.get_platform_list() except Exception as e: return { "status": "error", "message": f"AstrBot API error: {e.response.status_code if hasattr(e, 'response') else 'Unknown'}", "base_url": client.base_url, "detail": _httpx_error_detail(e), } status = result.get("status") if status != "ok": return { "status": status, "message": result.get("message"), "raw": result, } return { "platforms": result.get("data", {}).get("platforms", []), }
- astrbot_mcp/server.py:25-25 (registration)Registers the get_message_platforms tool function with the FastMCP server, explicitly naming it 'get_message_platforms'.server.tool(astrbot_tools.get_message_platforms, name="get_message_platforms")
- astrbot_mcp/tools/__init__.py:25-25 (registration)Re-exports the get_message_platforms function from platform_tools.py into the tools package namespace, making it available as astrbot_tools.get_message_platforms for server registration.from .platform_tools import get_message_platforms
- astrbot_mcp/server.py:50-50 (registration)Lists 'get_message_platforms' in the astrbot://info resource, advertising the available tools to MCP hosts."get_message_platforms",
- astrbot_mcp/tools.py:21-21 (helper)Re-exports get_message_platforms in the top-level tools.py for backward compatibility.get_message_platforms,