Skip to content

Automatic support package installation #41

@tohruk

Description

@tohruk

Summary

When Claude (or any MCP-connected AI agent) attempts to use a MATLAB function that requires an Add-On support package, it currently receives a hard error and falls back to a less accurate alternative — rather than installing the missing package and retrying. This degrades output quality silently and breaks the "just works" expectation of agentic workflows.

Current Behavior

When an agent calls a function backed by an uninstalled support package, MATLAB returns an error like:

peopleDetector requires the Computer Vision Toolbox Model for RTMDet Object Detection
support package. To install this support package, use the Add-On Explorer.

Because the Add-On Explorer is a GUI action, the agent cannot act on this link. In the example below, Claude initially attempted to use peopleDetector() (RTMDet-based, higher accuracy), hit this error, and silently fell back to the legacy HOG-based vision.PeopleDetector:

● matlab - evaluate_matlab_code  →  Error: peopleDetector requires the Computer Vision
  Toolbox Model for RTMDet Object Detection support package. To install this support
  package, use the Add-On Explorer.

● The default peopleDetector needs a support package. Let me use the classic
  HOG-based vision.PeopleDetector instead.

The agent never informed the user that it had downgraded its approach. The user asked for the best available method; they got a legacy fallback.

Desired Behavior

The MCP server should expose a mechanism for agents to:

  1. Detect that a function call failed due to a missing support package (parse the specific error pattern)
  2. Identify the required package name from the error message
  3. Install it programmatically — e.g. via matlab.addons.install(...) or matlab.addons.supportpackage.install(...)
  4. Retry the original function call automatically

Optionally, the server could expose a dedicated tool (e.g. install_support_package) so agents can make the install decision explicitly and transparently before executing code.

Why This Matters

  • Agentic workflows are non-interactive by design — GUI prompts are a dead end
  • Silent capability degradation is worse than a clear error; users lose trust when they discover the agent quietly used a worse method
  • Support package installation is already scriptable in MATLAB; the MCP layer just needs to surface it

Suggested API / Tool

{
  "tool": "install_support_package",
  "params": {
    "package_id": "RTMDET_DETECTION"
  }
}

Or as automatic middleware: intercept support-package errors before returning them to the agent, attempt a silent install, and retry once.

Environment

  • MATLAB MCP Core Server
  • Triggered via: Claude (claude-sonnet), agentic tool use
  • Example function affected: peopleDetector() (requires RTMDET_DETECTION)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementA request for new functionality or an improvement

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions