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;
    }

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A3.8/5.0
Behavior2/5

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

The description is minimal and does not disclose any behavioral traits beyond the basic operation. Since no annotations are provided, the description carries full burden, but it omits details like whether this is read-only, authentication requirements, or what 'configured' entails.

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 sentence with no extra words. It is front-loaded and every word earns its place.

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

Completeness4/5

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

For a simple list tool with no parameters, the description is sufficient to convey the purpose. However, it lacks details about the output format (e.g., array of references) which would improve 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 zero parameters and schema coverage is 100%. Description does not add parameter-level meaning but is not required to. Per guidelines, baseline is 4 for no parameters.

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

Purpose5/5

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

The description clearly states 'List all configured voice references' with a specific verb 'list' and resource 'voice references'. It effectively distinguishes from sibling tool fish_audio_tts, which implies text-to-speech synthesis.

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

Usage Guidelines3/5

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

The description provides no explicit guidance on when to use this tool versus fish_audio_tts. The context is implied by the resource 'voice references', but no alternatives or exclusions are mentioned.

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

Deploy Server

Other Tools