diff --git a/server.py b/server.py index b249495..92c3aae 100644 --- a/server.py +++ b/server.py @@ -45,7 +45,6 @@ from config import DEFAULT_MODEL, __version__ from tools.chat import ChatTool from tools.contentvariant import ContentVariantTool from tools.listmodels import ListModelsTool -from tools.models import ToolOutput from tools.version import VersionTool # Configure logging @@ -111,6 +110,20 @@ except Exception as e: logger = logging.getLogger(__name__) + +def get_follow_up_instructions(step_number: int = 0) -> str: + """ + Get follow-up instructions for conversation continuation. + + Args: + step_number: Current step number in workflow (0 for simple tools) + + Returns: + String with instructions for continuing the conversation + """ + return "" # Return empty string for now - tools handle their own continuation logic + + # Create MCP server instance server: Server = Server("zen-marketing") @@ -296,14 +309,16 @@ async def handle_call_tool(name: str, arguments: dict) -> list[TextContent]: try: tool = TOOLS[name] - result: ToolOutput = await tool.execute(arguments) + result = await tool.execute(arguments) - if result.is_error: - logger.error(f"Tool {name} failed: {result.text}") - else: + # Tools return list[TextContent], not ToolOutput + if isinstance(result, list): logger.info(f"Tool {name} completed successfully") - - return [TextContent(type="text", text=result.text)] + return result + else: + # Fallback for unexpected return type + logger.warning(f"Tool {name} returned unexpected type: {type(result)}") + return [TextContent(type="text", text=str(result))] except ValueError as e: # Validation errors from Pydantic or tool logic