-
Notifications
You must be signed in to change notification settings - Fork 543
fix: a2a_mcp example in python3 #224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -122,6 +122,7 @@ async def search_flights(session: ClientSession) -> CallToolResult: | |
| Returns: | ||
| The result of the tool call. | ||
| """ | ||
| # TODO: Implementation pending | ||
| logger.info("Calling 'search_flights' tool'") | ||
| return await session.call_tool( | ||
| name='search_flights', | ||
|
|
@@ -144,6 +145,7 @@ async def search_hotels(session: ClientSession) -> CallToolResult: | |
| Returns: | ||
| The result of the tool call. | ||
| """ | ||
| # TODO: Implementation pending | ||
| logger.info("Calling 'search_hotels' tool'") | ||
| return await session.call_tool( | ||
| name='search_hotels', | ||
|
|
@@ -160,14 +162,14 @@ async def query_db(session: ClientSession) -> CallToolResult: | |
|
|
||
| Args: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The docstring for Since the function currently uses a hardcoded SQL query for testing purposes, the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think there is any need to change the existing implementation,
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| session: The active ClientSession. | ||
| query: The natural language query to send to the 'search_hotels' tool. | ||
| query: The natural language query to send to the 'query_db' tool. | ||
|
|
||
| Returns: | ||
| The result of the tool call. | ||
kyoto7250 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| """ | ||
| logger.info("Calling 'search_hotels' tool'") | ||
| logger.info("Calling 'query_db' tool'") | ||
| return await session.call_tool( | ||
| name='query_db', | ||
| name='query_travel_data', | ||
holtskinner marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| arguments={ | ||
| 'query': "SELECT id, name, city, hotel_type, room_type, price_per_night FROM hotels WHERE city='London'", | ||
| }, | ||
|
|
@@ -186,6 +188,8 @@ async def main(host, port, transport, query, resource, tool): | |
| transport: Connection transport ('sse' or 'stdio'). | ||
| query: Optional query string for the 'find_agent' tool. | ||
| resource: Optional resource URI to read. | ||
| tool: Optional tool name to execute. Valid options are: | ||
| 'search_flights', 'search_hotels', or 'query_db'. | ||
| """ | ||
| logger.info('Starting Client to connect to MCP') | ||
| async with init_session(host, port, transport) as session: | ||
|
|
@@ -220,6 +224,8 @@ async def main(host, port, transport, query, resource, tool): | |
| @click.option('--transport', default='stdio', help='MCP Transport') | ||
| @click.option('--find_agent', help='Query to find an agent') | ||
| @click.option('--resource', help='URI of the resource to locate') | ||
| @click.option('--tool_name', type=click.Choice(['search_flights', 'search_hotels', 'query_db']), | ||
| help='Tool to execute: search_flights, search_hotels, or query_db') | ||
| def cli(host, port, transport, find_agent, resource, tool_name): | ||
| """A command-line client to interact with the Agent Cards MCP server.""" | ||
| asyncio.run(main(host, port, transport, find_agent, resource, tool_name)) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.