1515
1616# MCP imports
1717from mcp .server .fastmcp import FastMCP , Context
18- from mcp .types import TextContent
18+ from mcp .types import TextContent , ImageContent
1919# Removing the problematic import
2020# from mcp.server.tool import Tool, register_tool
2121
@@ -54,7 +54,7 @@ class BrowserTools(str, Enum):
5454 print ("Error: No API key provided. Please set the OPERATIVE_API_KEY environment variable." )
5555
5656@mcp .tool (name = BrowserTools .WEB_EVAL_AGENT )
57- async def web_eval_agent (url : str , task : str , ctx : Context , headless_browser : bool = False ) -> list [TextContent ]:
57+ async def web_eval_agent (url : str , task : str , ctx : Context , headless_browser : bool = False ) -> list [list [ TextContent | ImageContent ] ]:
5858 """Evaluate the user experience / interface of a web application.
5959
6060 This tool allows the AI to assess the quality of user experience and interface design
@@ -84,7 +84,7 @@ async def web_eval_agent(url: str, task: str, ctx: Context, headless_browser: bo
8484 error_message_str = "❌ Error: API Key validation failed when running the tool.\n "
8585 error_message_str += " Reason: Free tier limit reached.\n "
8686 error_message_str += " 👉 Please subscribe at https://operative.sh to continue."
87- return [TextContent (type = "text" , text = error_message_str )]
87+ return [[ TextContent (type = "text" , text = error_message_str )] ]
8888 try :
8989 # Generate a new tool_call_id for this specific tool call
9090 tool_call_id = str (uuid .uuid4 ())
@@ -95,10 +95,10 @@ async def web_eval_agent(url: str, task: str, ctx: Context, headless_browser: bo
9595 )
9696 except Exception as e :
9797 tb = traceback .format_exc ()
98- return [TextContent (
98+ return [[ TextContent (
9999 type = "text" ,
100100 text = f"Error executing web_eval_agent: { str (e )} \n \n Traceback:\n { tb } "
101- )]
101+ )]]
102102
103103@mcp .tool (name = BrowserTools .SETUP_BROWSER_STATE )
104104async def setup_browser_state (url : str = None , ctx : Context = None ) -> list [TextContent ]:
0 commit comments