Skip to main content
Glama
da-okazaki

MCP FishAudio Server

by da-okazaki

fish_audio_list_references

List all configured voice references available for text-to-speech synthesis through the MCP FishAudio Server integration.

Instructions

List all configured voice references

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function that implements the core logic of the 'fish_audio_list_references' tool. It loads the configuration, handles single vs multi-reference modes, uses ReferenceSelector to get all references, and returns a structured response indicating success, references list with default flag, or error.
    async run(): Promise<ListReferencesResponse> {
      try {
        const config = loadConfig();
        
        if (!config.references || config.references.length === 0) {
          return {
            success: true,
            references: [],
            defaultReference: config.defaultReference || config.referenceId,
            error: 'No references configured. Using single reference mode.'
          };
        }
        
        const selector = new ReferenceSelector(config.references, config.defaultReference);
        const references = selector.getAllReferences();
        
        return {
          success: true,
          references: references.map(ref => ({
            ...ref,
            isDefault: ref.id === config.defaultReference
          })),
          defaultReference: config.defaultReference
        };
      } catch (error) {
        return {
          success: false,
          error: error instanceof Error ? error.message : 'Unknown error occurred'
        };
      }
    }
  • Input schema definition for the tool, specifying an empty object (no required input parameters). The response type is defined by the ListReferencesResponse interface nearby.
    inputSchema = {
      type: 'object' as const,
      properties: {}
    };
  • src/index.ts:33-36 (registration)
    Tool registration in the MCP server: instantiates ListReferencesTool and adds it to the tools array used by ListToolsRequestSchema and CallToolRequestSchema handlers.
    const ttsTool = new TTSTool();
    const listRefTool = new ListReferencesTool();
    
    const tools = [ttsTool, listRefTool];
  • Helper method from ReferenceSelector class used in the handler to retrieve all configured voice references.
    getAllReferences(): ReferenceConfig[] {
      return this.references;
    }
  • Utility function to load and parse configuration including references from environment variables, used in the tool handler.
    export function loadConfig(): Config {
      if (configCache) {
        return configCache;
      }
    
      const apiKey = process.env.FISH_API_KEY;
      if (!apiKey) {
        throw new Error('FISH_API_KEY environment variable is required');
      }
    
      // Default to user's home directory for audio output
      const defaultOutputDir = join(homedir(), '.fish-audio-mcp', 'audio_output');
      let audioOutputDir = process.env.AUDIO_OUTPUT_DIR || defaultOutputDir;
      
      // Expand ~ to home directory if present
      if (audioOutputDir.startsWith('~/')) {
        audioOutputDir = join(homedir(), audioOutputDir.slice(2));
      }
      
      const resolvedOutputDir = resolve(audioOutputDir);
      
      // Create output directory if it doesn't exist
      try {
        if (!existsSync(resolvedOutputDir)) {
          mkdirSync(resolvedOutputDir, { recursive: true });
        }
      } catch (error) {
        logger.error(`Warning: Could not create audio output directory at ${resolvedOutputDir}. Audio files will be saved to memory only.`);
      }
    
      const streaming = parseBoolean(process.env.FISH_STREAMING, false);
      const autoPlay = parseBoolean(process.env.FISH_AUTO_PLAY, false);
      
      // Parse references
      const references = parseReferences();
      const defaultReference = process.env.FISH_DEFAULT_REFERENCE || process.env.FISH_REFERENCE_ID;
      
      const config: Config = {
        apiKey,
        modelId: process.env.FISH_MODEL_ID || 's1',
        referenceId: process.env.FISH_REFERENCE_ID, // Keep for backward compatibility
        references,
        defaultReference,
        outputFormat: parseAudioFormat(process.env.FISH_OUTPUT_FORMAT, 'mp3'),
        streaming: streaming,
        mp3Bitrate: parseMp3Bitrate(process.env.FISH_MP3_BITRATE, 128),
        audioOutputDir: resolvedOutputDir,
        autoPlay: autoPlay,
        websocketStreaming: false,  // Default to false for HTTP streaming
        realtimePlay: false  // Default to false for standard playback
      };
    
      configCache = config;
      return config;
    }
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 of behavioral disclosure. It states it's a list operation, implying it's likely read-only and non-destructive, but doesn't confirm this or add details like pagination, rate limits, or authentication needs. The description is minimal and lacks rich behavioral context beyond the basic action.

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 directly states the tool's purpose with no wasted words. It's appropriately sized and front-loaded, making it easy for an agent to parse quickly.

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

Completeness3/5

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

Given the tool has 0 parameters, no annotations, and no output schema, the description is minimal but covers the basic purpose. However, for a tool with no structured data support, it lacks details on return values, error handling, or behavioral traits, making it adequate but with clear gaps in completeness.

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

Parameters4/5

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

The tool has 0 parameters, and schema description coverage is 100%, so there are no parameters to document. The description doesn't need to add parameter semantics, and it appropriately doesn't mention any. A baseline of 4 is applied as it handles the zero-parameter case adequately without unnecessary information.

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 action ('List') and the resource ('all configured voice references'), providing a specific verb+resource combination. However, it doesn't differentiate from its sibling tool 'fish_audio_tts', which appears to be a text-to-speech tool rather than a listing tool, so the distinction is inherent but not explicitly stated.

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 the sibling tool 'fish_audio_tts' or any other context for usage, leaving the agent without explicit when/when-not instructions or alternatives.

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/da-okazaki/mcp-fish-audio-server'

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