Skip to content
Draft
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
20 changes: 11 additions & 9 deletions tavern/internal/mcp/tool_list_hosts.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,16 @@ func handleListHosts(ctx context.Context, request mcp.CallToolRequest) (*mcp.Cal
Principal string `json:"principal"`
}
type hostResult struct {
ID int `json:"id"`
Identifier string `json:"identifier"`
Name string `json:"name"`
Platform string `json:"platform"`
PrimaryIP string `json:"primaryIP"`
ExternalIP string `json:"externalIP"`
LastSeenAt string `json:"lastSeenAt"`
Tags []tagInfo `json:"tags"`
Beacons []beaconInfo `json:"beacons"`
ID int `json:"id"`
Identifier string `json:"identifier"`
Name string `json:"name"`
Platform string `json:"platform"`
PrimaryIP string `json:"primaryIP"`
ExternalIP string `json:"externalIP"`
LastSeenAt string `json:"lastSeenAt"`
NextSeenAt string `json:"nextSeenAt"`
Tags []tagInfo `json:"tags"`
Beacons []beaconInfo `json:"beacons"`
}

results := make([]hostResult, 0, len(hosts))
Expand All @@ -72,6 +73,7 @@ func handleListHosts(ctx context.Context, request mcp.CallToolRequest) (*mcp.Cal
PrimaryIP: h.PrimaryIP,
ExternalIP: h.ExternalIP,
LastSeenAt: h.LastSeenAt.Format(time.RFC3339),
NextSeenAt: h.NextSeenAt.Format(time.RFC3339),
}
for _, t := range h.Edges.Tags {
hr.Tags = append(hr.Tags, tagInfo{
Expand Down