Skip to content

Improve MCP server validation and preview action error handling#1

Open
SCPgamerscp wants to merge 1 commit intomainfrom
codex/request-code-review-and-debugging
Open

Improve MCP server validation and preview action error handling#1
SCPgamerscp wants to merge 1 commit intomainfrom
codex/request-code-review-and-debugging

Conversation

@SCPgamerscp
Copy link
Copy Markdown
Owner

Motivation

  • Fix a couple of robustness issues in the Python MCP server that cause unpredictable behavior when calling the YMM4 HTTP API.
  • Prevent invalid inputs (e.g. zero/negative speech speed) from producing incorrect timing calculations or runtime errors.
  • Provide clearer failure behavior for unsupported preview actions and make returned script summaries more readable.

Description

  • Modified ymm4_post signature to async def ymm4_post(path: str, body: dict | None = None) and construct a local payload to avoid a mutable default argument and ensure safe POST bodies.
  • Added validation in add_script to raise ValueError when chars_per_sec <= 0 to avoid invalid length calculations.
  • Changed script result summary logic so preview text only appends ... when the original text is longer than 20 characters.
  • Added an explicit case _ branch in dispatch_preview to raise a ValueError for unknown preview action values so unsupported actions fail fast and clearly.
  • File modified: mcp-server/server.py.

Testing

  • Ran python -m py_compile mcp-server/server.py and the file compiled successfully with no syntax errors.

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant