Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion internal/output/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,13 @@ func formatCard(card *a2a.AgentCard) string {
if len(card.SupportedInterfaces) > 0 {
sb.WriteString("Interfaces:\n")
for _, iface := range card.SupportedInterfaces {
fmt.Fprintf(&sb, " %-12s %s\n", iface.ProtocolBinding, iface.URL)
// Include protocol version so cards that expose more than one
// (e.g. 0.3 and 1.0 JSONRPC) are distinguishable (#88).
if iface.ProtocolVersion != "" {
fmt.Fprintf(&sb, " %-12s %-6s %s\n", iface.ProtocolBinding, iface.ProtocolVersion, iface.URL)
} else {
fmt.Fprintf(&sb, " %-12s %s\n", iface.ProtocolBinding, iface.URL)
}
}
}

Expand Down
19 changes: 19 additions & 0 deletions internal/output/output_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package output

import (
"bytes"
"strings"
"testing"

"github.com/google/go-cmp/cmp"
Expand Down Expand Up @@ -111,3 +112,21 @@ func TestMessageTextFileParts(t *testing.T) {
})
}
}

func TestFormatCard_InterfacesIncludeProtocolVersion(t *testing.T) {
card := &a2a.AgentCard{
Name: "Example Agent",
Version: "1.0.0",
SupportedInterfaces: []*a2a.AgentInterface{
{URL: "https://example.com/a2a/v03", ProtocolBinding: a2a.TransportProtocolJSONRPC, ProtocolVersion: "0.3"},
{URL: "https://example.com/a2a", ProtocolBinding: a2a.TransportProtocolJSONRPC, ProtocolVersion: a2a.Version},
},
}
out := formatCard(card)
if !strings.Contains(out, "JSONRPC") || !strings.Contains(out, "0.3") || !strings.Contains(out, "1.0") {
t.Fatalf("Interfaces output missing protocol versions:\n%s", out)
}
if !strings.Contains(out, "https://example.com/a2a/v03") {
t.Fatalf("missing interface URL:\n%s", out)
}
}
Loading