Skip to main content
Glama
mmaudio

MMAudio MCP

Official
by mmaudio

validate_api_key

Verify MMAudio API key validity and check account credits/status to ensure access to video-to-audio and text-to-audio generation services.

Instructions

Validate MMAudio API key and check account credits/status

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
api_keyNoMMAudio API key to validate (optional, uses configured key if not provided)

Implementation Reference

  • The handler function that executes the validate_api_key tool. It takes an optional api_key from args or uses the configured one, makes a GET request to /api/credits to validate it, and returns a JSON response with validation status and credits.
    async handleValidateApiKey(args) {
      const apiKey = args.api_key || this.config?.apiKey;
      
      if (!apiKey) {
        throw new McpError(ErrorCode.InvalidRequest, 'No API key provided');
      }
    
      try {
        console.error(`[MMAudio] Validating API key...`);
    
        // Try to fetch credits/usage endpoint to validate the key
        const response = await fetch(`${this.config?.baseUrl || 'https://mmaudio.net'}/api/credits`, {
          method: 'GET',
          headers: {
            'Authorization': `Bearer ${apiKey}`,
            'User-Agent': 'MMAudio-MCP/1.0.0',
          },
          timeout: 10000,
        });
    
        if (response.status === 401) {
          return {
            content: [
              {
                type: 'text',
                text: JSON.stringify({
                  success: false,
                  valid: false,
                  message: 'Invalid API key',
                  error: 'Authentication failed'
                }, null, 2),
              },
            ],
          };
        }
    
        if (!response.ok) {
          throw new Error(`HTTP ${response.status}: ${await response.text()}`);
        }
    
        const data = await response.json();
        
        console.error(`[MMAudio] API key validation successful`);
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({
                success: true,
                valid: true,
                message: 'API key is valid',
                credits: data.credits || 'Unknown',
                account_status: 'Active'
              }, null, 2),
            },
          ],
        };
      } catch (error) {
        console.error(`[MMAudio] API key validation failed:`, error);
        
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({
                success: false,
                valid: false,
                message: 'Failed to validate API key',
                error: error.message
              }, null, 2),
            },
          ],
        };
      }
    }
  • Tool registration in the listTools handler, defining the name, description, and input schema for validate_api_key.
    {
      name: 'validate_api_key',
      description: 'Validate MMAudio API key and check account credits/status',
      inputSchema: {
        type: 'object',
        properties: {
          api_key: {
            type: 'string',
            description: 'MMAudio API key to validate (optional, uses configured key if not provided)',
          },
        },
        required: [],
      },
    },
  • Dispatcher case in the CallToolRequestSchema handler that routes calls to validate_api_key to the handleValidateApiKey method.
    case 'validate_api_key':
      return await this.handleValidateApiKey(args);
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It states the tool validates an API key and checks account credits/status, but doesn't disclose behavioral traits such as what happens on validation failure (e.g., error messages), whether it makes network calls, rate limits, authentication requirements beyond the key, or the format of the status response. This is a significant gap for a tool with no annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose without unnecessary words. Every part earns its place by specifying the tool's actions and targets, making it appropriately sized for its function.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (validation with potential network interaction), lack of annotations, and no output schema, the description is incomplete. It doesn't explain what the tool returns (e.g., credit balance, validation result), error conditions, or behavioral details, leaving gaps for an AI agent to use it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with the parameter 'api_key' fully documented in the schema. The description adds no additional meaning beyond what the schema provides (e.g., it doesn't explain key format or validation rules). With high schema coverage, the baseline is 3, as the description doesn't compensate but doesn't need to.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with specific verbs ('validate', 'check') and resources ('MMAudio API key', 'account credits/status'). It distinguishes this as a validation/status-checking tool rather than a processing tool like its siblings (text_to_audio, video_to_audio). However, it doesn't explicitly differentiate from potential sibling validation tools (none listed), so it falls short of a perfect 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., before using text_to_audio), when not to use it, or how it relates to sibling tools. The only implied usage is for validation, but this is basic and lacks context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mmaudio/mmaudio-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server