Skip to content
Open
Changes from 1 commit
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
26 changes: 24 additions & 2 deletions hud/cli/utils/interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from typing import Any

import questionary
from mcp.types import TextContent
from mcp.types import ImageContent, TextContent
from rich.console import Console
from rich.panel import Panel
from rich.prompt import Prompt
Expand Down Expand Up @@ -242,7 +242,18 @@ async def get_tool_arguments(self, tool: Any) -> dict[str, Any] | None:
# Prompt for each property
args = {}
for prop_name, prop_schema in properties.items():
prop_type = prop_schema.get("type", "string")
prop_type = prop_schema.get("type")
if not prop_type and ("anyOf" in prop_schema or "oneOf" in prop_schema):
prop_type = next(
(
s.get("type")
for s in (prop_schema["anyOf"] or prop_schema["oneOf"] or [])
if s.get("type") != "null"
),
None,
)
prop_type = prop_type or "string"

description = prop_schema.get("description", "")
is_required = prop_name in required

Expand Down Expand Up @@ -353,6 +364,17 @@ async def call_tool(self, tool: Any, arguments: dict[str, Any]) -> None:
border_style="green" if not result.isError else "red",
)
)
elif isinstance(content, ImageContent):
mime_type = getattr(content, "mimeType", "image/png")
data_length = len(content.data) if hasattr(content, "data") else 0
console.print(
Panel(
f"📷 Image ({mime_type})\n"
f"Size: {data_length:,} bytes (base64 encoded)",
title="Result",
border_style="green" if not result.isError else "red",
)
)
else:
# Handle other content types
console.print(json.dumps(content, indent=2))
Expand Down
Loading