@@ -55,31 +55,31 @@ async def test_register_manual_discovers_tools(transport: McpCommunicationProtoc
5555 assert len (register_result .manual .tools ) == 4
5656
5757 # Find the echo tool
58- echo_tool = next ((tool for tool in register_result .manual .tools if tool .name == " echo" ), None )
58+ echo_tool = next ((tool for tool in register_result .manual .tools if tool .name == f" { SERVER_NAME } . echo" ), None )
5959 assert echo_tool is not None
6060 assert "echoes back its input" in echo_tool .description
6161
6262 # Check for other tools
6363 tool_names = [tool .name for tool in register_result .manual .tools ]
64- assert " greet" in tool_names
65- assert " list_items" in tool_names
66- assert " add_numbers" in tool_names
64+ assert f" { SERVER_NAME } . greet" in tool_names
65+ assert f" { SERVER_NAME } . list_items" in tool_names
66+ assert f" { SERVER_NAME } . add_numbers" in tool_names
6767
6868
6969@pytest .mark .asyncio
7070async def test_call_tool_succeeds (transport : McpCommunicationProtocol , mcp_manual : McpCallTemplate ):
7171 """Verify a successful tool call after registration."""
7272 await transport .register_manual (None , mcp_manual )
7373
74- result = await transport .call_tool (None , " echo" , {"message" : "test" }, mcp_manual )
74+ result = await transport .call_tool (None , f" { SERVER_NAME } . echo" , {"message" : "test" }, mcp_manual )
7575
7676 assert result == {"reply" : "you said: test" }
7777
7878
7979@pytest .mark .asyncio
8080async def test_call_tool_works_without_register (transport : McpCommunicationProtocol , mcp_manual : McpCallTemplate ):
8181 """Verify that calling a tool works without prior registration in session-per-operation mode."""
82- result = await transport .call_tool (None , " echo" , {"message" : "test" }, mcp_manual )
82+ result = await transport .call_tool (None , f" { SERVER_NAME } . echo" , {"message" : "test" }, mcp_manual )
8383 assert result == {"reply" : "you said: test" }
8484
8585
@@ -88,7 +88,7 @@ async def test_structured_output_tool(transport: McpCommunicationProtocol, mcp_m
8888 """Test that tools with structured output (TypedDict) work correctly."""
8989 await transport .register_manual (None , mcp_manual )
9090
91- result = await transport .call_tool (None , " echo" , {"message" : "test" }, mcp_manual )
91+ result = await transport .call_tool (None , f" { SERVER_NAME } . echo" , {"message" : "test" }, mcp_manual )
9292 assert result == {"reply" : "you said: test" }
9393
9494
@@ -97,7 +97,7 @@ async def test_unstructured_string_output(transport: McpCommunicationProtocol, m
9797 """Test that tools returning plain strings work correctly."""
9898 await transport .register_manual (None , mcp_manual )
9999
100- result = await transport .call_tool (None , " greet" , {"name" : "Alice" }, mcp_manual )
100+ result = await transport .call_tool (None , f" { SERVER_NAME } . greet" , {"name" : "Alice" }, mcp_manual )
101101 assert result == "Hello, Alice!"
102102
103103
@@ -106,7 +106,7 @@ async def test_list_output(transport: McpCommunicationProtocol, mcp_manual: McpC
106106 """Test that tools returning lists work correctly."""
107107 await transport .register_manual (None , mcp_manual )
108108
109- result = await transport .call_tool (None , " list_items" , {"count" : 3 }, mcp_manual )
109+ result = await transport .call_tool (None , f" { SERVER_NAME } . list_items" , {"count" : 3 }, mcp_manual )
110110
111111 assert isinstance (result , list )
112112 assert len (result ) == 3
@@ -118,7 +118,7 @@ async def test_numeric_output(transport: McpCommunicationProtocol, mcp_manual: M
118118 """Test that tools returning numeric values work correctly."""
119119 await transport .register_manual (None , mcp_manual )
120120
121- result = await transport .call_tool (None , " add_numbers" , {"a" : 5 , "b" : 7 }, mcp_manual )
121+ result = await transport .call_tool (None , f" { SERVER_NAME } . add_numbers" , {"a" : 5 , "b" : 7 }, mcp_manual )
122122
123123 assert result == 12
124124
@@ -132,7 +132,7 @@ async def test_deregister_manual(transport: McpCommunicationProtocol, mcp_manual
132132
133133 await transport .deregister_manual (None , mcp_manual )
134134
135- result = await transport .call_tool (None , " echo" , {"message" : "test" }, mcp_manual )
135+ result = await transport .call_tool (None , f" { SERVER_NAME } . echo" , {"message" : "test" }, mcp_manual )
136136 assert result == {"reply" : "you said: test" }
137137
138138
@@ -145,7 +145,7 @@ async def test_register_resources_as_tools_disabled(transport: McpCommunicationP
145145
146146 # Check that no resource tools are present
147147 tool_names = [tool .name for tool in register_result .manual .tools ]
148- resource_tools = [name for name in tool_names if name .startswith (" resource_" )]
148+ resource_tools = [name for name in tool_names if name .startswith (f" { SERVER_NAME } . resource_" )]
149149 assert len (resource_tools ) == 0
150150
151151
@@ -160,13 +160,13 @@ async def test_register_resources_as_tools_enabled(transport: McpCommunicationPr
160160
161161 # Check that resource tools are present
162162 tool_names = [tool .name for tool in register_result .manual .tools ]
163- resource_tools = [name for name in tool_names if name .startswith (" resource_" )]
163+ resource_tools = [name for name in tool_names if name .startswith (f" { SERVER_NAME } . resource_" )]
164164 assert len (resource_tools ) == 2
165- assert " resource_get_test_document" in resource_tools
166- assert " resource_get_config" in resource_tools
165+ assert f" { SERVER_NAME } . resource_get_test_document" in resource_tools
166+ assert f" { SERVER_NAME } . resource_get_config" in resource_tools
167167
168168 # Check resource tool properties
169- test_doc_tool = next ((tool for tool in register_result .manual .tools if tool .name == " resource_get_test_document" ), None )
169+ test_doc_tool = next ((tool for tool in register_result .manual .tools if tool .name == f" { SERVER_NAME } . resource_get_test_document" ), None )
170170 assert test_doc_tool is not None
171171 assert "Read resource:" in test_doc_tool .description
172172 assert "file://test_document.txt" in test_doc_tool .description
@@ -179,7 +179,7 @@ async def test_call_resource_tool(transport: McpCommunicationProtocol, mcp_manua
179179 await transport .register_manual (None , mcp_manual_with_resources )
180180
181181 # Call the test document resource
182- result = await transport .call_tool (None , " resource_get_test_document" , {}, mcp_manual_with_resources )
182+ result = await transport .call_tool (None , f" { SERVER_NAME } . resource_get_test_document" , {}, mcp_manual_with_resources )
183183
184184 # Check that we get the resource content
185185 assert isinstance (result , dict )
@@ -207,7 +207,7 @@ async def test_call_resource_tool_json_content(transport: McpCommunicationProtoc
207207 await transport .register_manual (None , mcp_manual_with_resources )
208208
209209 # Call the config.json resource
210- result = await transport .call_tool (None , " resource_get_config" , {}, mcp_manual_with_resources )
210+ result = await transport .call_tool (None , f" { SERVER_NAME } . resource_get_config" , {}, mcp_manual_with_resources )
211211
212212 # Check that we get the resource content
213213 assert isinstance (result , dict )
@@ -232,14 +232,14 @@ async def test_call_resource_tool_json_content(transport: McpCommunicationProtoc
232232async def test_call_nonexistent_resource_tool (transport : McpCommunicationProtocol , mcp_manual_with_resources : McpCallTemplate ):
233233 """Verify that calling a non-existent resource tool raises an error."""
234234 with pytest .raises (ValueError , match = "Resource 'nonexistent' not found in any configured server" ):
235- await transport .call_tool (None , " resource_nonexistent" , {}, mcp_manual_with_resources )
235+ await transport .call_tool (None , f" { SERVER_NAME } . resource_nonexistent" , {}, mcp_manual_with_resources )
236236
237237
238238@pytest .mark .asyncio
239239async def test_resource_tool_without_registration (transport : McpCommunicationProtocol , mcp_manual_with_resources : McpCallTemplate ):
240240 """Verify that resource tools work even without prior registration."""
241241 # Don't register the manual first - test direct call
242- result = await transport .call_tool (None , " resource_get_test_document" , {}, mcp_manual_with_resources )
242+ result = await transport .call_tool (None , f" { SERVER_NAME } . resource_get_test_document" , {}, mcp_manual_with_resources )
243243
244244 # Should still work and return content
245245 assert isinstance (result , dict )
0 commit comments