inspect_astrbot_config
Explore and analyze AstrBot configuration JSON structure step-by-step to inspect nodes, list keys, and drill down into specific paths for debugging and management.
Instructions
Inspect a node in an AstrBot config JSON.
This tool is designed for step-by-step exploration:
Start with path=None to list top-level keys.
Then drill down by providing a deeper path.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| conf_id | Yes | ||
| system_config | Yes | ||
| path | Yes | ||
| include_value | Yes | ||
| max_children | Yes | ||
| redact_secrets | Yes | ||
| max_string_length | Yes |
Implementation Reference
- Core handler function that executes the inspect_astrbot_config tool: connects to AstrBot, fetches config, navigates path, summarizes node with configurable options.async def inspect_astrbot_config( *, conf_id: str | None = None, system_config: bool = False, path: str | List[Any] | None = None, include_value: bool = False, max_children: int = 50, redact_secrets: bool = True, max_string_length: int = 200, ) -> Dict[str, Any]: """ Inspect a node in an AstrBot config JSON. This tool is designed for step-by-step exploration: - Start with path=None to list top-level keys. - Then drill down by providing a deeper path. """ client = AstrBotClient.from_env() if system_config and conf_id: return {"status": "error", "message": "Do not pass conf_id when system_config=true"} if not system_config and not conf_id: return {"status": "error", "message": "conf_id is required unless system_config=true"} try: api_result = await client.get_abconf(conf_id=conf_id, system_config=system_config) except Exception as e: return { "status": "error", "message": _astrbot_connect_hint(client), "base_url": client.base_url, "detail": _httpx_error_detail(e), } status = api_result.get("status") if status != "ok": return {"status": status, "message": api_result.get("message"), "raw": api_result} config = (api_result.get("data") or {}).get("config") if not isinstance(config, dict): return {"status": "error", "message": "AstrBot returned invalid config payload", "raw": api_result} try: path_segments = _parse_path(path) node = _get_node(config, path_segments) leaf_name = None if path_segments and isinstance(path_segments[-1], str): leaf_name = path_segments[-1] summary = _summarize_node( node, max_children=max_children, include_value=include_value, redact_secrets=redact_secrets, leaf_name=leaf_name, max_string_length=max_string_length, ) return { "conf_id": conf_id, "system_config": system_config, "path": path_segments, "node": summary, } except Exception as e: return { "status": "error", "message": str(e), "conf_id": conf_id, "system_config": system_config, "path": path, }
- astrbot_mcp/server.py:35-35 (registration)Registers the inspect_astrbot_config tool function with the FastMCP server instance, making it available via MCP.server.tool(astrbot_tools.inspect_astrbot_config, name="inspect_astrbot_config")
- astrbot_mcp/tools/__init__.py:28-32 (registration)Imports and re-exports the inspect_astrbot_config function from config_tools.py into the tools package for use by server.py.from .config_tools import ( list_astrbot_config_files, inspect_astrbot_config, apply_astrbot_config_ops, )
- astrbot_mcp/server.py:57-57 (registration)Lists the tool in the astrbot://info resource for discovery by MCP hosts."inspect_astrbot_config",