MiniMax-AI / MiniMax-AI/MiniMax-MCP

bug(server): text_to_audio validates text outside try/except, inconsistent with other tools

Open Beginner friendly
#88 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.6k
Forks
284
PR merge metrics
No merged PRs in 30d

Description

Summary

In minimax_mcp/server.py, the input validation for text_to_audio is performed outside the try/except MinimaxAPIError block, while every other tool function performs its validation inside the block. This means invalid input to text_to_audio propagates as an unhandled MinimaxRequestError exception, while invalid input to peer tools is caught and returned as a TextContent error message.

Code shape

text_to_audio (around line 90-91):

def text_to_audio(
    text: str, ...
) -> TextContent:
    if not text:
        raise MinimaxRequestError("Text is required.")  # <-- OUTSIDE try/except

    try:
        # ... main work ...
    except MinimaxAPIError as e:
        return TextContent(type="text", text=f"Failed to convert text to audio: {str(e)}")

text_to_image, music_generation, voice_clone, etc. all do the equivalent check inside the try block, so their MinimaxRequestError is caught and returned as a TextContent.

Impact

  • Inconsistent client experience: a missing text to text_to_audio crashes the tool call; the same kind of missing input to text_to_image returns a friendly error.
  • An MCP client that doesn't catch MinimaxRequestError (and most don't, since it's an implementation detail) sees a tool crash instead of a structured error.

Suggested fix

Move the if not text: raise MinimaxRequestError(...) check from outside the try to inside it, matching the pattern in the other tools. This is a one-line move.

Discovered via

Issue filed as a follow-up to PR #87 (test coverage). The test added in #87 (test_text_to_audio_with_empty_text_raises) currently expects MinimaxRequestError to propagate, but to make the behavior consistent with the rest of the file, that expectation should probably flip to a TextContent return value.

🤖 Generated with Claude Code

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in minimax_mcp/server.py at text_to_audio and compare its validation and try/except structure with text_to_image, music_generation, and voice_clone. Run test_text_to_audio_with_empty_text_raises from PR #87, then verify that empty text produces the same structured TextContent error behavior as the other tools.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
1/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
82/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.