bug(server): text_to_audio validates text outside try/except, inconsistent with other tools
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 1/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 82/100
Hướng nghiên cứu
Bắt đầu trong minimax_mcp/server.py tại text_to_audio và so sánh cấu trúc validation và try/except của nó với text_to_image, music_generation và voice_clone. Chạy test_text_to_audio_with_empty_text_raises từ PR #87, sau đó xác minh rằng văn bản rỗng tạo ra cùng hành vi lỗi TextContent có cấu trúc như các công cụ khác.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
texttotext_to_audiocrashes the tool call; the same kind of missing input totext_to_imagereturns 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
- Ngôn ngữ chính
- Python
- Star
- 1.6k
- Fork
- 283
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của MiniMax-AI/MiniMax-MCP
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
MiniMax-AI/MiniMax-MCP#89 · 1 bình luận ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
MiniMax-AI/MiniMax-MCP#78 ·
-
fix(server): music_generation has inconsistent indentation — try block indented inside function bodyĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
MiniMax-AI/MiniMax-MCP#69 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 35/100
MiniMax-AI/MiniMax-MCP#105 · 1 bình luận ·
-
bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
MiniMax-AI/MiniMax-MCP#103 ·
Tất cả issue của MiniMax-AI/MiniMax-MCP
Issue tương tự
-
Claiming namespace `apoint`Đang mởnamespace operations
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
EclipseFdn/open-vsx.org#13573 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
collective/icalendar#1854 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
rancher/rancher-ai-agent#412 ·
Maintainer thường phản hồi trong vòng 6 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
TUDelftGeodesy/DePSI#134 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
HenriquesLab/rxiv-maker#335 ·