Skip to content

[Dev UI] Migrate Tool request/response components to expansion panel pattern #6208

Description

@MichaelDoyle

Description

Currently, <code-block> and <reasoning> components in the Genkit Developer UI are implemented using <mat-expansion-panel> with the shared rendered-block-expansion-panel mixin. This gives them:

  • Collapsible body panels (collapsible on click/keyboard for long snippets)
  • Standardized header typography and padding
  • A copy-to-clipboard action button in the header

In contrast, <tool-request> and <tool-response> components are implemented using plain <div> containers (.toolrequest-container, .toolresponse-container) with bespoke header markup. As a result:

  • They cannot be collapsed when tool request/response JSON payloads are large.
  • They lack a copy button in the header to easily copy tool inputs/outputs.
  • Their styling requires duplicated SCSS rather than inheriting the shared expansion panel mixin.

Proposed Changes

  1. Refactor to <mat-expansion-panel>:

    • Update tool-request.component.html and tool-response.component.html to use <mat-expansion-panel [expanded]="true">.
    • Use <mat-expansion-panel-header> to house the tool name, reference ID chip (#ref), tooltip, and action buttons.
  2. Add Header Actions:

    • Add a Copy button (<button mat-icon-button matTooltip="Copy">) to copy the highlighted/formatted JSON payload to clipboard.
  3. Style Consolidation:

    • Apply the mixins.rendered-block-expansion-panel() mixin to tool-request.component.scss and tool-response.component.scss, removing redundant custom container styling and aligning all message blocks into 100% architectural and visual parity.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions