feat(server): validate numeric and enum tool params locally before API calls (#66)#85
Open
TumCucTom wants to merge 1 commit into
Open
feat(server): validate numeric and enum tool params locally before API calls (#66)#85TumCucTom wants to merge 1 commit into
TumCucTom wants to merge 1 commit into
Conversation
…I calls Tool functions (text_to_audio, text_to_image, music_generation) accept parameters with documented valid ranges and enums but performed no local validation. Invalid values were forwarded to the API, producing cryptic errors and wasting API quota on requests that could never succeed. Add per-parameter validation: - Module-level enums for sample_rate / bitrate / emotion / format / aspect_ratio, and ranges for speed / vol / pitch / channel / n. - _validate_range() and _validate_enum() helpers in minimax_mcp/validators.py that raise MinimaxValidationError (already defined in exceptions.py) with a clear message. - Validation calls at the top of each affected tool function. Fixes MiniMax-AI#66. Co-authored-by: Zippy AI <tomkinsbale@icloud.com> Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
minimax_mcp/const.py.minimax_mcp/validators.pywith_validate_range()and_validate_enum()helpers that raiseMinimaxValidationError.text_to_audio,text_to_image, andmusic_generationat the top of each function body.tests/test_validators.pycovering all helpers and the documented tool params.Why
Issue #66: invalid numeric/enum values were forwarded to the API, producing cryptic errors and wasting quota. Local validation surfaces clear messages up front and prevents impossible requests.
Test plan
tests/test_validators.pycovers range and enum helpers, boundary values, and end-to-end tool function callspytest tests/greenFixes #66.
🤖 Generated with Claude Code