#121

fix(mcp): models error recommends the disabled media profile

Opencoygeekopened 9d ago

Summary

Calling models on an MCP server started with --profile media returns an error that recommends starting the server with the same profile. Following that first suggestion leaves the tool disabled. The alternative --profile all is valid; the defect is the first recovery suggestion.

Steps to reproduce

With the published CLI installed, run this Python 3 script. It starts the server with an empty temporary home and working directory, passes no credential variables, and sends only local MCP requests.

import json
import os
import shutil
import subprocess
import tempfile

ai = shutil.which("ai")
assert ai is not None, "Install ai-cli first"
requests = [
    {"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {
        "protocolVersion": "2025-11-25", "capabilities": {},
        "clientInfo": {"name": "repro", "version": "1.0.0"}}},
    {"jsonrpc": "2.0", "method": "notifications/initialized"},
    {"jsonrpc": "2.0", "id": 2, "method": "tools/list"},
    {"jsonrpc": "2.0", "id": 3, "method": "tools/call", "params": {
        "name": "models", "arguments": {}}},
    {"jsonrpc": "2.0", "id": 4, "method": "shutdown"},
]
with tempfile.TemporaryDirectory() as directory:
    result = subprocess.run(
        [ai, "mcp", "--profile", "media"],
        input="".join(json.dumps(request) + "\n" for request in requests),
        text=True, capture_output=True, timeout=10, cwd=directory,
        env={"HOME": directory, "PATH": os.environ["PATH"], "NO_COLOR": "1"},
    )
    print(result.stdout, end="")
    print("exit:", result.returncode)

The tools/list response omits models; the tools/call response with ID 3 contains the misleading recovery instruction. For a local control, start separate servers with --profile core and --profile all and send initialize, tools/list, and shutdown only. Both list models. No model service call is needed.

Expected behavior

Keep rejecting models when the active profile excludes it, and suggest a profile that enables it, such as core or all. A recovery instruction should not recommend restarting with the same profile that just rejected the tool.

Actual behavior

The call returns this result:

{"jsonrpc":"2.0","id":3,"result":{"content":[{"type":"text","text":"models is not enabled in profile media; start the server with `ai mcp --profile media` or `--profile all`"}],"isError":true}}

The server exits with status 0 after shutdown. The observed tool lists were:

media: video_start, video_status, audio_speak, audio_transcribe
core:  text, image, decide, models
all:   text, image, decide, models, video_start, video_status, audio_speak, audio_transcribe

The release runtime reproduced the message. Current default-branch source retains the same static suggestion; the default branch was inspected, not built or executed.

Runtime or environment

Version or commit

  • Executed release: ai-cli 0.8.0, npm latest and GitHub's latest stable release, release source bd9d87a8ead2ff247b669fc6d4bcac90e8d96353.
  • Inspected default branch: main at 20592fdd6deb68e09856f675a54e685b05b02226, whose package manifest declares 0.8.1. This was not treated as a published release.

Environment

Node.js v26.12.1, arm64. The child process received only HOME, PATH, and NO_COLOR; it used disposable local directories and no API credentials.

Operating system

macOS

Evidence

  • Expected source: The release's models mapping assigns it to core; the profile construction includes each tool in its assigned profile and all. The local tools/list controls confirm these memberships.
  • Failure source: The inline MCP response from the isolated release run above; the current disabled-tool branch uses the same static suggestion.
  • Evidence provenance: observed
  • Local verification: reproduced
  • Reproduction completeness: complete

Restoration check

Repeat the same models call under media. It should still return isError: true, and each profile the error recommends should advertise models in its tools/list response. Retain the controls showing that core and all list the tool. This checks the recovery text without changing profile membership or making a model service request.

Additional context

This report concerns the actionable error text. It does not request adding core tools to the media profile.

Co-contributor credit

No, do not credit me

Checklist

  • I have searched existing issues for duplicates.
  • I have removed API keys, tokens, credentials, and private data from this report.

Triage assessment

  • Impact level: P3
  • Assessment status: supported
  • Impact basis: The first recovery suggestion repeats a profile that excludes the requested tool. The tool remains correctly disabled, and the same message already offers a valid alternative; no additional operational harm was observed.
  • Workaround status: available
  • Workaround basis: Use --profile all, already suggested in the error, or --profile core. Both were observed to advertise models; executing the model catalog tool was outside this local check.

Activity

0

No activity yet.