← All Components
<mth-tool-call>
Collapsible AI tool invocation card displaying execution status, escaped JSON arguments, and sanitized text output.
When NOT to use: Use a lightweight @methane-ui/css layout class instead of a custom element when static CSS suffices.
Live Interactive Preview
Ready · interact with <mth-tool-call>, or toggle Theme, Direction (LTR/RTL), or props above.
Multi-Framework Playground & Snippets
<script type="module" src="@methane-ui/ai/tool-call"></script>
<mth-tool-call status="pending" duration-ms="null">Example</mth-tool-call>import '@methane-ui/ai/tool-call';
import '@methane-ui/react';
export function Example() {
return <mth-tool-call status="pending" duration-ms="null">Example</mth-tool-call>;
}<script setup lang="ts">
import '@methane-ui/ai/tool-call';
</script>
<template>
<mth-tool-call status="pending" duration-ms="null">Example</mth-tool-call>
</template>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@methane-ui/ai/tool-call';
import { MthToolCallDirective } from '@methane-ui/angular';
@Component({
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [MthToolCallDirective],
template: `<mth-tool-call status="pending" duration-ms="null">Example</mth-tool-call>`,
})
export class ExampleComponent {}<script lang="ts">
import '@methane-ui/ai/tool-call';
import MthToolCall from '@methane-ui/svelte/MthToolCall.svelte';
</script>
<MthToolCall status="pending" duration-ms="null">Example</MthToolCall>Properties & Attributes
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
name | name | string | "" | Invoked tool function name. |
status | status | 'pending' | 'running' | 'success' | 'error' | "pending" | Current tool status (pending | running | success | error). |
open | open | boolean | false | Whether arguments and output details are expanded. |
args | — | unknown | — | JSON-serializable arguments payload. |
output | — | unknown | — | JSON-serializable or text output payload. |
durationMs | duration-ms | number | null | null | Optional execution latency in milliseconds. |
Events
| Event | Detail Type | Description |
|---|---|---|
mth-toggle | { open: boolean; status: string } | Fired when the user toggles the tool details panel. |
APG Keyboard Matrix
| Key | Direction | When | Expected Behavior |
|---|---|---|---|
| Enter | both | trigger button focused | expands or collapses tool details |
| Space | both | trigger button focused | expands or collapses tool details |
Accessibility Checklist
| Category | Requirement | Verified By |
|---|---|---|
| aria | All aria-* IDREFs resolve within the same DOM root (ADR-003). | scanSameRootAria |
| focus | Focus ownership matches focusModel="none". | lint-plugin & spec-compiler |
| contrast | Renders legible borders, focus outlines, and selection indicators under forced-colors: active. | Playwright forced-colors matrix |
| keyboard | Implements all 2 APG keyboard transitions across LTR/RTL. | mth-tool-call.spec.test.ts |
| states | Exposes ElementInternals CustomStateSet flags: :state(open), :state(pending), :state(running), :state(success), :state(error). | Conformance suite |
| i18n | Routes 8 UI/ARIA strings through @methane-ui/core i18n catalog. | Locale context test |