Skip to content

Show Tool Calls having data part in UI#142

Closed
SathishKumarRamasamy wants to merge 4 commits intoa2aproject:mainfrom
SathishKumarRamasamy:SathishKumarRamasamy-patch-1
Closed

Show Tool Calls having data part in UI#142
SathishKumarRamasamy wants to merge 4 commits intoa2aproject:mainfrom
SathishKumarRamasamy:SathishKumarRamasamy-patch-1

Conversation

@SathishKumarRamasamy
Copy link

No description provided.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @SathishKumarRamasamy, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the A2A Inspector's user interface by enabling the proper display and formatting of function calls and responses, which were previously shown as raw JSON or ignored. By introducing dedicated rendering logic and visual styling, the inspector now provides a much clearer and more intuitive view of agent interactions, making it easier to debug and understand complex tool-based conversations.

Highlights

  • Improved DataPart Display: The A2A Inspector now intelligently detects and formats function calls, function responses, and generic structured data, moving away from raw JSON display.
  • New Formatting Functions: Introduced formatFunctionCall(), formatFunctionResponse(), and formatStructuredData() to render DataParts in a user-friendly, structured manner.
  • Comprehensive Event Processing: The status-update event handler was updated to process all message parts, ensuring DataParts are no longer ignored.
  • Enhanced UI Styling: A new CSS file (tool-styles.css) was added to provide distinct visual styling for function calls (purple), responses (green), and structured data (light blue), including dark mode support and animations.
Changelog
  • ENHANCEMENTS.md
    • Added detailed documentation outlining the problem, enhancements, new helper functions, updated event handler, CSS styling, usage instructions, before/after examples, visual examples, technical details, event flow, verification steps, troubleshooting, related documentation, and impact of the changes.
  • frontend/public/index.html
    • Linked the new tool-styles.css stylesheet to integrate the new UI styling.
  • frontend/public/tool-styles.css
    • Added comprehensive CSS rules for styling .tool-call, .tool-response, and .structured-data elements, including gradients, borders, fonts, dark mode support, responsive adjustments, and animations.
  • frontend/src/script.ts
    • Implemented formatFunctionCall, formatFunctionResponse, and formatStructuredData helper functions to generate HTML for different DataPart types.
    • Modified processPart to detect and utilize these new formatting functions for data parts, prioritizing function calls, then responses, then media, and finally generic structured data.
    • Updated the status-update event handler to iterate through all event.status.message.parts and process each using processPart, ensuring all content types are displayed.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The pull request introduces significant enhancements to the A2A Inspector UI, specifically improving the display of function calls and responses (DataParts). Previously, these were shown as raw JSON or ignored, but now they are presented in a user-friendly, formatted manner with distinct styling. New helper functions (formatFunctionCall, formatFunctionResponse, formatStructuredData) have been added to script.ts to handle the intelligent detection and rendering of different DataPart types. The status-update event handler has been updated to process all parts of a message, not just text. Additionally, a new CSS file (tool-styles.css) has been added to provide custom styling, including dark mode support and animations, for these new UI elements. The index.html file has been updated to link this new CSS file. Overall, these changes greatly improve the usability and clarity of the A2A Inspector for debugging and understanding agent behavior.

Comment on lines +278 to +280
**Created**: 2026-02-22
**Author**: Cline AI Assistant
**Version**: 1.0.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

It is best practice to avoid hardcoding dates, authors, or versions directly into documentation files like this. This information can quickly become outdated and lead to maintenance overhead. Consider using a dynamic system or a separate changelog for versioning and authorship.

Comment on lines +990 to +996
.map(([key, value]) => {
const sanitizedKey = DOMPurify.sanitize(key);
const sanitizedValue = DOMPurify.sanitize(JSON.stringify(value));
return `<div class="tool-arg">├─ <span class="arg-key">${sanitizedKey}:</span> <span class="arg-value">${sanitizedValue}</span></div>`;
})
.join('');
argsHtml = `<div class="tool-args">${argsList}</div>`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The JSON.stringify(value) call for sanitizedValue might produce a string that includes quotes around primitive types (e.g., "15" instead of 15). This could make the output less readable for simple values. Consider checking the type of value and only stringifying complex objects, or using a more sophisticated pretty-printing function that handles primitives gracefully.

          const sanitizedValue = DOMPurify.sanitize(typeof value === 'object' && value !== null ? JSON.stringify(value) : String(value));

Comment on lines +1013 to +1019
.map(([key, value]) => {
const sanitizedKey = DOMPurify.sanitize(key);
const sanitizedValue = DOMPurify.sanitize(JSON.stringify(value, null, 2));
return `<div class="tool-arg">└─ <span class="arg-key">${sanitizedKey}:</span> <span class="arg-value">${sanitizedValue}</span></div>`;
})
.join('');
responseHtml = `<div class="tool-response-content">${responseList}</div>`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Similar to the formatFunctionCall function, JSON.stringify(value, null, 2) for sanitizedValue might add unnecessary quotes around primitive values, affecting readability. A more nuanced approach to stringification could improve the display.

          const sanitizedValue = DOMPurify.sanitize(typeof value === 'object' && value !== null ? JSON.stringify(value, null, 2) : String(value));

Comment on lines +1146 to +1148
const combinedContent = allContent.join('');
const kindChip = `<span class="kind-chip kind-chip-status-update">${event.kind}</span>`;
const messageHtml = `${kindChip} ${combinedContent}`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The kindChip is currently prepended to the combinedContent without any spacing, which might lead to poor readability in the UI. Adding a non-breaking space or a small margin between the chip and the content would improve the visual separation.

          const combinedContent = allContent.join('');
          const kindChip = `<span class="kind-chip kind-chip-status-update">${event.kind}</span>`;
          const messageHtml = `${kindChip}&nbsp;${combinedContent};`

@SathishKumarRamasamy SathishKumarRamasamy deleted the SathishKumarRamasamy-patch-1 branch February 22, 2026 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant