changed the mcp import to match the venv structure

This commit is contained in:
2026-01-30 18:24:56 +01:00
parent 5fef91e110
commit 62fea062a4

View File

@@ -9,7 +9,7 @@ from events.event import Event
from typing import Any, Dict from typing import Any, Dict
import logging import logging
import httpx import httpx
from mcp.server.fastmcp import FastMCP from mcp.server import FastMCP
import json import json
import os import os
@@ -373,27 +373,10 @@ async def add_event(location:str, initial_description:str, entity_list:list[str]
@mcp.tool()
async def save_game_state() -> str:
"""Save the current game state to a persistent storage each time
the game state is modified."""
logging.info("Saving game state")
with open("game_state.json", "w", encoding="utf-8") as f:
f.write(game.serialize())
return "Game state saved to game_state.json"
@mcp.tool()
async def purge_game_history_and_state() -> str:
"""Purge the game history and state files when the player is starting a new game."""
if os.path.exists(HISTORY_FILE):
os.remove(HISTORY_FILE)
if os.path.exists("game_state.json"):
os.remove("game_state.json")
return "Game history and state purged."
def main(): def main():
# Initialize and run the server # Initialize and run the server