-
Notifications
You must be signed in to change notification settings - Fork 790
add A2UI over MCP sample #540
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces an A2UI over MCP sample, including a README, Python server code, and A2UI JSON definition. The changes are generally well-structured, but I've identified a few areas for improvement related to correctness, maintainability, and minor stylistic issues. Specifically, there's an invalid icon name in the A2UI JSON, reliance on a private API in the server, and a suppressed type ignore that could be clarified or resolved.
| "literalString": "local_fire_department" | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The icon name "local_fire_department" is not listed as an allowed enum value in the standard_catalog_definition.json (lines 90-139). Using an undefined icon might lead to rendering issues or an empty icon being displayed. Please choose an icon from the allowed enum values to ensure correct rendering.
| sse = SseServerTransport("/messages/") | ||
|
|
||
| async def handle_sse(request: Request): | ||
| async with sse.connect_sse(request.scope, request.receive, request._send) as streams: # type: ignore[reportPrivateUsage] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
|
||
| from server import main | ||
|
|
||
| sys.exit(main()) # type: ignore[call-arg] No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The type: ignore[call-arg] comment suggests a type incompatibility that is being suppressed. It's best practice to either fix the underlying type issue to ensure type safety or provide a more detailed comment explaining why the ignore is necessary and what the expected behavior is, to aid future maintainers.
| # MCP throws an error for "type":"array" so wrapping in an object | ||
| # TODO fix this in MCP SDK |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
samples/agent/adk/mcp/server.py
Outdated
|
|
||
| server_to_client_json["properties"]["surfaceUpdate"]["properties"]["components"]["items"]["properties"]["component"]["properties"] = standard_catalog_json | ||
|
|
||
| return wrap_as_json_array(server_to_client_json) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
MCP Inspector Screenshot validating server: