Skip to content

UI MCP tool definitions and automations service#7601

Open
cstns wants to merge 2 commits into
7430_mcp-platform-toolsfrom
7561_frontend-mcp-tool-wrappers
Open

UI MCP tool definitions and automations service#7601
cstns wants to merge 2 commits into
7430_mcp-platform-toolsfrom
7561_frontend-mcp-tool-wrappers

Conversation

@cstns

@cstns cstns commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Description

Implements the frontend-side UI tool definitions and dispatch service for the first-party agent. This covers the three tools described in #7561 (context, route discovery, navigation) but with an architectural change: tool definitions and execution live in the frontend, not on the agent.

The original issue assumes tools are implemented on the agent side and exposed over MQTT. We moved them to the frontend because the 3rd party agent serves multiple Forge instances (cloud and self-hosted) running different frontend versions, each with potentially different UI capabilities. Having the frontend declare its own tools means the agent doesn't need to hardcode version-specific knowledge. It discovers tools dynamically per session.

What's here:

  • frontend/src/mcp/tools/ with three tool files, each exporting an array of tool definitions using JSON Schema (serializable for MQTT transport)
    • context.ts - ui.get-context: reads from the context store's expert getter
    • routes.ts - ui.list-routes: returns available routes from the router with name, path, and metadata
    • navigation.ts - ui.navigate: validates route exists, calls router.push()
  • frontend/src/mcp/tools/index.ts aggregates all tool files
  • frontend/src/services/automations.service.ts - lifecycle service following the existing BaseService pattern. getToolDefinitions() returns definitions without handlers (for MQTT discovery). dispatch(toolName, args) looks up and executes the handler.
  • MCP types under frontend/src/types/mcp/
  • Wired into service registry and ServiceInstances type

The service is self-contained and ready to be called when the MQTT inflight bridge lands. $services.automations.getToolDefinitions() for discovery, $services.automations.dispatch(toolName, args) for execution.

Related Issue(s)

closes #7561

Checklist

  • I have read the contribution guidelines
  • Suitable unit/system level tests have been added and they pass
  • Documentation has been updated
    • Upgrade instructions
    • Configuration details
    • Concepts
  • Changes flowforge.yml?
    • Issue/PR raised on FlowFuse/helm to update ConfigMap Template
    • Issue/PR raised on FlowFuse/CloudProject to update values for Staging/Production
  • Link to Changelog Entry PR, or note why one is not needed.

Labels

  • Includes a DB migration? -> add the area:migration label

@cstns cstns self-assigned this Jun 24, 2026
@cstns cstns changed the base branch from main to 7430_mcp-platform-tools June 24, 2026 10:11
@codecov

codecov Bot commented Jun 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.70%. Comparing base (6d631cc) to head (7efc967).

Additional details and impacted files
@@                   Coverage Diff                    @@
##           7430_mcp-platform-tools    #7601   +/-   ##
========================================================
  Coverage                    76.70%   76.70%           
========================================================
  Files                          420      420           
  Lines                        21260    21260           
  Branches                      5157     5157           
========================================================
  Hits                         16308    16308           
  Misses                        4952     4952           
Flag Coverage Δ
backend 76.70% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

Expert Agent Frontend Tool Wrappers

1 participant