Skip to content

fix: include MCP tools in /v1/tools endpoint so they appear in web UI#116

Open
mricharz wants to merge 1 commit intoopen-jarvis:mainfrom
mricharz:fix/mcp-tools-ui-visibility
Open

fix: include MCP tools in /v1/tools endpoint so they appear in web UI#116
mricharz wants to merge 1 commit intoopen-jarvis:mainfrom
mricharz:fix/mcp-tools-ui-visibility

Conversation

@mricharz
Copy link
Copy Markdown
Contributor

@mricharz mricharz commented Mar 25, 2026

Summary

  • MCP tools discovered from external servers (configured in [tools.mcp]) were injected into managed agent streaming requests but never listed in the GET /v1/tools API response, making them invisible in the agent creation wizard
  • The list_tools() endpoint now calls _get_mcp_tools() to lazily discover and cache MCP tools, appending them with source: "mcp" and category: "mcp"
  • Frontend shows MCP tools under a new MCP / External category with proper search, responsive layout, and visual improvements

Changes

Backend (agent_manager_routes.py):

  • Add _get_mcp_tools(app_state) — lazy MCP tool discovery with per-process caching on app_state
  • Update list_tools() to accept Request, call _get_mcp_tools(), and append results
  • Graceful fallback: if MCP discovery fails, built-in tools still returned

Frontend (AgentsPage.tsx, api.ts):

  • Add 'MCP / External' category to tool picker with auto-detection via source === 'mcp'
  • Add search/filter input with whitespace AND-matching (e.g. "ha get" matches ha_get_state)
  • Responsive dialog width (md:max-w-2xl lg:max-w-3xl) and 3-column tool grid on large screens
  • Wrap tools section in bordered container for visual separation
  • Budget field uses info tooltip instead of hint text (consistent with other fields)
  • Extended ToolInfo.source type to include 'mcp'

Tests (test_tools_endpoint.py):

  • test_tools_includes_mcp_tools: verifies MCP tools appear in /v1/tools with correct fields
  • test_tools_graceful_mcp_failure: verifies built-in tools returned when MCP is unavailable

Test plan

  • pytest tests/server/test_tools_endpoint.py -v — all tests pass
  • Configure an MCP server in config.toml, verify tools appear at GET /v1/tools with source: "mcp"
  • Open agent creation wizard, verify MCP tools shown under "MCP / External" category
  • Test search with spaces (e.g. "ha get") matches underscore-separated tool names
  • Verify budget/learning fields aligned on wide screens

@mricharz mricharz force-pushed the fix/mcp-tools-ui-visibility branch from 6af9ded to 60f60d0 Compare March 25, 2026 03:28
The GET /v1/tools endpoint only returned tools from ToolRegistry and
ChannelRegistry. MCP tools discovered via external servers were injected
into streaming requests but never listed in the API response, making them
invisible in the agent creation wizard.

Backend:
- Add _get_mcp_tools() for lazy MCP tool discovery with caching
- Update list_tools() to append MCP tools with source/category "mcp"

Frontend:
- Add 'MCP / External' category to agent wizard tool picker
- Add tool search/filter with whitespace AND-matching
- Responsive dialog width (md:2xl, lg:3xl) and 3-column tool grid
- Wrap tools in bordered container for visual separation
- Budget field uses tooltip instead of hint text (consistent with others)
- Align info icons with labels

Tests:
- test_tools_includes_mcp_tools: verifies MCP tools appear in response
- test_tools_graceful_mcp_failure: verifies built-in tools work without MCP
@mricharz mricharz force-pushed the fix/mcp-tools-ui-visibility branch from 60f60d0 to e059b96 Compare March 25, 2026 03:31
@robbym-dev
Copy link
Copy Markdown
Collaborator

Hey @mricharz — thanks for this! The MCP tool discovery and frontend integration look solid, and all tests pass.

A couple things before we can merge:

  1. Rebase needed — there are merge conflicts in agent_manager_routes.py and AgentsPage.tsx since both files have changed significantly on main.
  2. Add logging for MCP failures — the except Exception: pass in _get_mcp_tools() silently swallows errors, which makes it hard to debug misconfigured MCP servers. Could you add a logger.warning(...) there?

Let us know if you need any help with the rebase!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants