Minimal stand-in that satisfies the methods ChatContext uses.
| 19 | # Dummy async ToolManager stub |
| 20 | # --------------------------------------------------------------------------- |
| 21 | class DummyToolManager: # noqa: E501 - test helper |
| 22 | """Minimal stand-in that satisfies the methods ChatContext uses.""" |
| 23 | |
| 24 | def __init__(self) -> None: |
| 25 | self._tools = [ |
| 26 | ToolInfo( |
| 27 | name="tool1", |
| 28 | namespace="srv1", |
| 29 | description="demo-1", |
| 30 | parameters={}, |
| 31 | is_async=False, |
| 32 | ), |
| 33 | ToolInfo( |
| 34 | name="tool2", |
| 35 | namespace="srv2", |
| 36 | description="demo-2", |
| 37 | parameters={}, |
| 38 | is_async=False, |
| 39 | ), |
| 40 | ] |
| 41 | |
| 42 | self._servers = [ |
| 43 | ServerInfo( |
| 44 | id=0, |
| 45 | name="srv1", |
| 46 | status="ok", |
| 47 | tool_count=1, |
| 48 | namespace="srv1", |
| 49 | ), |
| 50 | ServerInfo( |
| 51 | id=1, |
| 52 | name="srv2", |
| 53 | status="ok", |
| 54 | tool_count=1, |
| 55 | namespace="srv2", |
| 56 | ), |
| 57 | ] |
| 58 | |
| 59 | self._openai_tools = [ |
| 60 | { |
| 61 | "type": "function", |
| 62 | "function": { |
| 63 | "name": f"{t.namespace}_{t.name}", |
| 64 | "description": t.description, |
| 65 | "parameters": t.parameters, |
| 66 | }, |
| 67 | } |
| 68 | for t in self._tools |
| 69 | ] |
| 70 | |
| 71 | # ----- discovery -------------------------------------------------- |
| 72 | async def get_unique_tools(self): # noqa: D401 - match signature |
| 73 | return self._tools |
| 74 | |
| 75 | async def get_server_info(self): # noqa: D401 - match signature |
| 76 | return self._servers |
| 77 | |
| 78 | async def get_adapted_tools_for_llm(self, provider: str = "openai"): |
no outgoing calls