Skip to content

fix(server): music_generation has inconsistent indentation — try block indented inside function body #69

@alfonsodg

Description

@alfonsodg

Problem

The music_generation() function has its entire try block indented one extra level compared to all other tool functions. This is a style inconsistency that suggests a copy-paste error.

Exact location

  • File: minimax_mcp/server.py
  • Function: music_generation()

Evidence

def music_generation(...) -> TextContent:
        try:  # <-- extra indentation (8 spaces instead of 4)
            if not prompt:
                raise MinimaxRequestError("Prompt is required.")
            ...
        except MinimaxAPIError as e:
            return TextContent(
                type="text",
                text=f"Failed to generate music: {str(e)}"
            )
        except (IOError, requests.RequestException) as e:
            return TextContent(
                type="text",
                text=f"Failed to save music: {str(e)}"
        )  # <-- closing paren misaligned

Compare with text_to_audio():

def text_to_audio(...):
    if not text:  # <-- correct indentation (4 spaces)
        raise MinimaxRequestError("Text is required.")
    ...

Impact

  • Code works but is confusing to read
  • The misaligned closing paren on the last except could mask bugs
  • Linters (ruff, flake8) would flag this

Proposed solution

Dedent the entire function body by one level to match other functions. Fix the misaligned closing paren.

Acceptance criteria

  • music_generation() body indented at 4 spaces (same as all other functions)
  • All closing parens properly aligned
  • ruff check passes with no indentation warnings

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions