Root Causes & Fixes
Issue 1 β @gr.mcp.tool() doesn't register tools in gr.Blocks mode
The decorator only sets metadata attributes on the function (fn._mcp_type = "tool"). Gradio's MCP server discovers tools by scanning api_info["named_endpoints"] β functions connected to Blocks event handlers via .click() etc. Module-level decorated functions that aren't connected to any component are invisible to the MCP server.
Fix: Added gr.api() calls inside the Blocks context for all 5 tool functions. gr.api() registers a function as a named API endpoint without requiring UI components, which is exactly what the MCP server scans.
Issue 2 β No hourly forecast tab or event handler
The web UI had no π Hourly Forecast tab and no event handler, so get_hourly_forecast was doubly missing β from both the web UI and the MCP server.
Fix: Added the hourly_forecast_handler function and a π Hourly Forecast tab with a location textbox, hours slider (1β168), and a button.
Issue 3 β UI click handlers polβ¦