MCPcopy Create free account
hub / github.com/IBM/mcp-cli / test_with_internal_tools

Method test_with_internal_tools

tests/chat/test_testing.py:181–198  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

179
180 @pytest.mark.asyncio
181 async def test_with_internal_tools(self):
182 from mcp_cli.chat.testing import TestChatContext
183
184 tools = [_make_tool("t1", "Tool 1"), _make_tool("t2", "Tool 2")]
185 sm = _make_stream_manager(tools=tools, has_internal_tools=True)
186 mm = _make_model_manager()
187 ctx = TestChatContext(sm, mm)
188
189 await ctx._initialize_tools()
190
191 assert len(ctx.tools) == 2
192 assert len(ctx.openai_tools) == 2
193 assert ctx.openai_tools[0]["type"] == "function"
194 assert ctx.openai_tools[0]["function"]["name"] == "t1"
195 assert ctx.tool_to_server_map == {"t1": "test-server", "t2": "test-server"}
196 assert ctx.internal_tools == list(ctx.tools)
197 assert ctx.tool_name_mapping == {}
198 sm.get_server_info.assert_called_once()
199
200 @pytest.mark.asyncio
201 async def test_falls_back_to_get_all_tools(self):

Callers

nothing calls this directly

Calls 5

_initialize_toolsMethod · 0.95
TestChatContextClass · 0.90
_make_stream_managerFunction · 0.85
_make_toolFunction · 0.70
_make_model_managerFunction · 0.70

Tested by

no test coverage detected