26 lines
622 B
Python
26 lines
622 B
Python
"""Refresh the lightweight offline MCP catalog after changing tool signatures."""
|
|
|
|
import asyncio
|
|
import json
|
|
from pathlib import Path
|
|
import sys
|
|
|
|
ROOT = Path(__file__).resolve().parent.parent
|
|
sys.path.insert(0, str(ROOT))
|
|
|
|
from mcp_server import mcp
|
|
|
|
|
|
async def main():
|
|
catalog = {
|
|
"instructions": mcp.instructions,
|
|
"tools": [tool.model_dump(exclude_none=True) for tool in await mcp.list_tools()],
|
|
}
|
|
(ROOT / "mcp_server" / "catalog.json").write_text(
|
|
json.dumps(catalog, ensure_ascii=False, indent=2) + "\n", encoding="utf-8"
|
|
)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(main())
|