diff --git a/client/src/components/ToolsTab.tsx b/client/src/components/ToolsTab.tsx index 19d8fa0c..659e3180 100644 --- a/client/src/components/ToolsTab.tsx +++ b/client/src/components/ToolsTab.tsx @@ -65,49 +65,69 @@ const hasAnnotations = ( (tool as { annotations?: unknown }).annotations !== null; // Helper to render annotation badges +// Shows all 4 annotation values with their state (true/false/implied default) const AnnotationBadges = ({ annotations, }: { - annotations: ToolAnnotations; + annotations: ToolAnnotations | undefined; }) => { - const badges: { - label: string; - variant: "default" | "destructive" | "secondary" | "outline"; - }[] = []; + // Spec defaults: readOnlyHint=false, destructiveHint=true, idempotentHint=false, openWorldHint=true + const getValueAndImplied = ( + value: boolean | undefined, + defaultValue: boolean, + ): { value: boolean; implied: boolean } => ({ + value: value ?? defaultValue, + implied: value === undefined, + }); - if (annotations.readOnlyHint === true) { - badges.push({ label: "Read-only", variant: "secondary" }); - } - if (annotations.destructiveHint === true) { - badges.push({ label: "Destructive", variant: "destructive" }); - } - if (annotations.idempotentHint === true) { - badges.push({ label: "Idempotent", variant: "outline" }); - } - if (annotations.openWorldHint === true) { - badges.push({ label: "Open-world", variant: "default" }); - } + const readOnly = getValueAndImplied(annotations?.readOnlyHint, false); + const destructive = getValueAndImplied(annotations?.destructiveHint, true); + const idempotent = getValueAndImplied(annotations?.idempotentHint, false); + const openWorld = getValueAndImplied(annotations?.openWorldHint, true); - if (badges.length === 0) return null; + const badges = [ + { + label: "Read-only", + value: readOnly.value, + implied: readOnly.implied, + }, + { + label: "Destructive", + value: destructive.value, + implied: destructive.implied, + }, + { + label: "Idempotent", + value: idempotent.value, + implied: idempotent.implied, + }, + { + label: "Open-world", + value: openWorld.value, + implied: openWorld.implied, + }, + ]; return (
{selectedTool.description}
- {hasAnnotations(selectedTool) && ( -