55 CLOUD_SDK_CFG_AGW_DEFAULT_TENANT_SUBDOMAIN=<tenant-subdomain> \\
66 CLOUD_SDK_CFG_AGW_DEFAULT_LANDSCAPE=<landscape> \\
77 CLOUD_SDK_CFG_AGW_DEFAULT_USER_TOKEN=<user-jwt> \\
8+ CLOUD_SDK_CFG_AGW_DEFAULT_SAMPLE_MCP_TOOL=<tool-name> \\
89 CLOUD_SDK_CFG_DESTINATION_DEFAULT_CLIENTID=... \\
910 CLOUD_SDK_CFG_DESTINATION_DEFAULT_CLIENTSECRET=... \\
1011 CLOUD_SDK_CFG_DESTINATION_DEFAULT_URL=... \\
@@ -52,6 +53,7 @@ def __init__(self):
5253 self .user_token : Optional [str ] = None
5354 self .tools : Optional [list [MCPTool ]] = None
5455 self .tool_result : Optional [str ] = None
56+ self .sample_mcp_tool_name : Optional [str ] = None
5557
5658
5759@pytest .fixture
@@ -78,6 +80,15 @@ def have_valid_user_token(context: ScenarioContext):
7880 context .user_token = token
7981
8082
83+ @given ("I have a sample MCP tool name" )
84+ def have_sample_mcp_tool_name (context : ScenarioContext ):
85+ """Load sample MCP tool name from environment variable."""
86+ tool_name = os .environ .get ("CLOUD_SDK_CFG_AGW_DEFAULT_SAMPLE_MCP_TOOL" , "" )
87+ if not tool_name :
88+ pytest .skip ("CLOUD_SDK_CFG_AGW_DEFAULT_SAMPLE_MCP_TOOL is not set — skipping tool scenario" )
89+ context .sample_mcp_tool_name = tool_name
90+
91+
8192# ==================== WHEN ====================
8293
8394
@@ -119,18 +130,17 @@ def call_get_user_auth_empty_token(context: ScenarioContext, agw_client: AgentGa
119130@when ("I call list_mcp_tools" )
120131def call_list_mcp_tools (context : ScenarioContext , agw_client : AgentGatewayClient ):
121132 """Call list_mcp_tools and store the result."""
122- context .tools = run (agw_client .list_mcp_tools ())
133+ context .tools = run (agw_client .list_mcp_tools (user_token = context . user_token ))
123134
124135
125- @when (parsers .parse ('I call call_mcp_tool with "{tool_name}" and the user token' ))
126- def call_call_mcp_tool (
127- context : ScenarioContext , agw_client : AgentGatewayClient , tool_name : str
128- ):
129- """Find tool by name from list_mcp_tools result and call it."""
136+ @when ("I call call_mcp_tool with the sample MCP tool and the user token" )
137+ def call_call_mcp_tool_sample (context : ScenarioContext , agw_client : AgentGatewayClient ):
138+ """Find the sample MCP tool and call it."""
130139 assert context .tools is not None , "call list_mcp_tools before calling a tool"
131- tool = next ((t for t in context .tools if t .name == tool_name ), None )
140+ assert context .sample_mcp_tool_name is not None
141+ tool = next ((t for t in context .tools if t .name == context .sample_mcp_tool_name ), None )
132142 if tool is None :
133- pytest .fail (f"Tool '{ tool_name } ' not found in list_mcp_tools result" )
143+ pytest .fail (f"Tool '{ context . sample_mcp_tool_name } ' not found in list_mcp_tools result" )
134144 context .tool_result = run (
135145 agw_client .call_mcp_tool (tool , user_token = context .user_token )
136146 )
@@ -237,6 +247,19 @@ def each_tool_has_non_empty_url(context: ScenarioContext):
237247 )
238248
239249
250+ @then ("each tool should have a valid input_schema" )
251+ def each_tool_has_valid_input_schema (context : ScenarioContext ):
252+ """Verify every tool has an input_schema dict with type=object."""
253+ assert context .tools is not None
254+ for tool in context .tools :
255+ assert isinstance (tool .input_schema , dict ), (
256+ f"Tool '{ tool .name } ' input_schema is not a dict: { tool .input_schema !r} "
257+ )
258+ assert tool .input_schema .get ("type" ) == "object" , (
259+ f"Tool '{ tool .name } ' input_schema missing type=object: { tool .input_schema } "
260+ )
261+
262+
240263@then ("the tool result should be a non-empty string" )
241264def tool_result_is_non_empty_string (context : ScenarioContext ):
242265 """Verify the tool invocation returned a non-empty string."""
0 commit comments