forked from universal-tool-calling-protocol/python-utcp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient.py
More file actions
25 lines (19 loc) · 693 Bytes
/
Copy pathclient.py
File metadata and controls
25 lines (19 loc) · 693 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import asyncio
from os import getcwd
from utcp.client.utcp_client import UtcpClient
async def main():
client: UtcpClient = await UtcpClient.create(
config={"providers_file_path": "./providers.json"}
)
# List all available tools
print("Registered tools:")
for tool in await client.tool_repository.get_tools():
print(f" - {tool.name}")
# Call one of the tools
tool_to_call = (await client.tool_repository.get_tools())[0].name
args = {"body": {"value": "test"}}
result = await client.call_tool(tool_to_call, args)
print(f"\nTool call result for '{tool_to_call}':")
print(result)
if __name__ == "__main__":
asyncio.run(main())