Skip to content

Commit 365545c

Browse files
Benny ChenBenny Chen
authored andcommitted
more fixes
1 parent 266d3f6 commit 365545c

File tree

9 files changed

+24
-857
lines changed

9 files changed

+24
-857
lines changed

eval_protocol/mcp/client/connection.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import logging
1212
import time
1313
from contextlib import AsyncExitStack
14-
from typing import Any, Dict, List, Optional, Tuple
14+
from typing import Any, Dict, List, Optional, Tuple, cast
1515

1616
import httpx
1717
from mcp.client.session import ClientSession
@@ -276,7 +276,10 @@ async def _get_initial_state_from_mcp_resource(self, session: MCPSession) -> Any
276276
try:
277277
# List available resources - this is where initial state should come from
278278
logger.debug(f"Session {session.session_id}: Discovering MCP resources for initial state...")
279-
resources_response = await mcp_session.list_resources()
279+
mcp_session_local = session._mcp_session
280+
if mcp_session_local is None:
281+
raise RuntimeError("Session not initialized while listing resources")
282+
resources_response = await mcp_session_local.list_resources()
280283
resources = resources_response.resources if hasattr(resources_response, "resources") else []
281284
logger.debug(f"Session {session.session_id}: Found {len(resources)} MCP resources")
282285
for resource in resources:
@@ -303,7 +306,10 @@ async def _get_initial_state_from_mcp_resource(self, session: MCPSession) -> Any
303306
f"Session {session.session_id}: Reading initial state from resource: {initial_state_resource.uri}"
304307
)
305308

306-
resource_content = await mcp_session.read_resource(initial_state_resource.uri)
309+
mcp_session_for_read = session._mcp_session
310+
if mcp_session_for_read is None:
311+
raise RuntimeError("Session not initialized while reading resource")
312+
resource_content = await mcp_session_for_read.read_resource(initial_state_resource.uri)
307313

308314
# Handle the new ResourceContents format
309315
text_value = getattr(resource_content, "text", None)
@@ -348,7 +354,10 @@ async def _get_initial_state_from_mcp_resource(self, session: MCPSession) -> Any
348354
f"Session {session.session_id}: About to call mcp_session.read_resource with fallback URI: {first_resource.uri}"
349355
)
350356

351-
resource_content = await mcp_session.read_resource(first_resource.uri)
357+
mcp_session_for_fallback_read = session._mcp_session
358+
if mcp_session_for_fallback_read is None:
359+
raise RuntimeError("Session not initialized while reading fallback resource")
360+
resource_content = await mcp_session_for_fallback_read.read_resource(first_resource.uri)
352361

353362
logger.debug(
354363
f"Session {session.session_id}: fallback read_resource returned type: {type(resource_content)}"

eval_protocol/mcp_agent/intermediary_server.py

Lines changed: 0 additions & 541 deletions
This file was deleted.

eval_protocol/mcp_agent/orchestration/remote_http_client.py

Lines changed: 0 additions & 307 deletions
This file was deleted.

eval_protocol/mcp_env.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,11 @@ def make(
136136

137137
if evaluation_rows:
138138
for i, row in enumerate(evaluation_rows):
139-
dataset_info = row.input_metadata.dataset_info if row.input_metadata else {}
139+
dataset_info = (
140+
row.input_metadata.dataset_info
141+
if (row.input_metadata and row.input_metadata.dataset_info is not None)
142+
else {}
143+
)
140144

141145
system_message = row.get_system_message()
142146
system_prompt = system_message.content or ""

eval_protocol/mcp_servers/tau2/airplane_environment/airline_environment.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ def close(self):
6868

6969
def _execute_airline_action(self, action_name: str, parameters: Dict[str, Any]) -> Dict[str, Any]:
7070
"""Execute action using airline tools."""
71+
assert isinstance(self.airline_tools, AirlineTools), "Airline tools not initialized"
7172
action_map = {
7273
"book_reservation": self.airline_tools.book_reservation,
7374
"cancel_reservation": self.airline_tools.cancel_reservation,

eval_protocol/playback_policy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ async def __call__(
224224
tool_schemas: List[Dict],
225225
env_index: int,
226226
conversation_history: List[Dict[str, Any]],
227-
):
227+
) -> Tuple[List["MCPToolCall"], Optional[Dict[str, int]], Optional[str]]:
228228
"""
229229
Main policy call method. Delegates to playback or live mode.
230230

eval_protocol/rewards/cpp_code.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ def _ioi_cpp_code_reward_impl(
608608
},
609609
)
610610

611-
response_content = messages[-1].content
611+
response_content = messages[-1].content if isinstance(messages[-1].content, str) else ""
612612

613613
expected_output_str_from_gt: Optional[str] = None
614614
test_cases_from_gt: Optional[List[Dict[str, Any]]] = None

0 commit comments

Comments
 (0)