import json import logging from tool_agent.tool.tool_store import PostgreSQLToolStore logging.basicConfig(level=logging.INFO) def dump_tools(): store = PostgreSQLToolStore() tools = store.list_all(limit=1000) connected = [] unconnected = [] for t in tools: if t.get("status") == "已接入": connected.append({ "id": t.get("id"), "name": t.get("name"), "introduction": t.get("introduction"), "capability_ids": t.get("capability_ids", []) }) else: unconnected.append({ "id": t.get("id"), "name": t.get("name"), "introduction": t.get("introduction"), "capability_ids": t.get("capability_ids", []) }) with open("tool_dump.json", "w", encoding="utf-8") as f: json.dump({"connected": connected, "unconnected": unconnected}, f, ensure_ascii=False, indent=2) print(f"Dumped {len(connected)} connected tools and {len(unconnected)} unconnected tools.") if __name__ == "__main__": dump_tools()