Skip to main content
Glama

get_speakers

Read-only

Retrieve available podcast speakers with filtering by language to select voices for audio generation. Returns speaker details including ID, name, language, gender, and demo audio.

Instructions

Get list of available published speakers for podcast generation. Supports filtering by language code (e.g. "zh", "en"). Returns speaker ID, name, language, gender and demo audio URL. Defaults to Chinese speakers if no language specified.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
languageNoFilter by language code (e.g. "zh" for Chinese, "en" for English). Default: zhzh

Implementation Reference

  • The main execution handler for the get_speakers MCP tool. It fetches the list of published speakers filtered by language using the client, formats them into a numbered Markdown table with details (ID, language, gender, demo URL), handles empty results and errors, and returns a user-friendly string response.
    async execute(args: {language?: string}, {log}: {log: any}) {
    	try {
    		const language = args.language ?? 'zh';
    		log.info(`Fetching published speakers for language: ${language}`);
    
    		const response = await client.speakers.getSpeakers(language);
    
    		if (response.code !== 0) {
    			return `Error: ${response.message ?? 'Failed to get speakers'}`;
    		}
    
    		const speakers = response.data?.items ?? [];
    
    		if (speakers.length === 0) {
    			return `No speakers available for language: ${language}`;
    		}
    
    		const speakerTable = speakers
    			.map(
    				(s: Speaker, index: number) =>
    					`${index + 1}. ${s.name}\n   - ID: ${s.speakerId}\n   - Language: ${s.language}\n   - Gender: ${s.gender}\n   - Audio Preview: [🎧 Listen to voice sample](${s.demoAudioUrl})`,
    			)
    			.join('\n\n');
    
    		log.info(`Successfully fetched ${speakers.length} published speakers`);
    		return `Found ${speakers.length} available speakers for language: ${language}\n\nYou can use either the speaker name or speaker ID when creating podcasts.\n\n${speakerTable}`;
    	} catch (error) {
    		const errorMessage = formatError(error);
    		log.error('Failed to get speakers', {error: errorMessage});
    		return `Failed to get speakers: ${errorMessage}`;
    	}
    },
  • Zod schema defining the input parameters for the get_speakers tool: an optional 'language' string parameter defaulting to 'zh'.
    parameters: z.object({
    	language: z
    		.string()
    		.optional()
    		.default('zh')
    		.describe(
    			'Filter by language code (e.g. "zh" for Chinese, "en" for English). Default: zh',
    		),
    }),
  • The registration function that adds the get_speakers tool to the FastMCP server, including name, description, input schema, annotations, and handler.
    export function registerSpeakersTools(
    	server: FastMCP,
    	client: ListenHubClient,
    ) {
    	server.addTool({
    		name: 'get_speakers',
    		description:
    			'Get list of available published speakers for podcast generation. Supports filtering by language code (e.g. "zh", "en"). Returns speaker ID, name, language, gender and demo audio URL. Defaults to Chinese speakers if no language specified.',
    		parameters: z.object({
    			language: z
    				.string()
    				.optional()
    				.default('zh')
    				.describe(
    					'Filter by language code (e.g. "zh" for Chinese, "en" for English). Default: zh',
    				),
    		}),
    		annotations: {
    			title: 'Get Speakers',
    			openWorldHint: true,
    			readOnlyHint: true,
    		},
    		async execute(args: {language?: string}, {log}: {log: any}) {
    			try {
    				const language = args.language ?? 'zh';
    				log.info(`Fetching published speakers for language: ${language}`);
    
    				const response = await client.speakers.getSpeakers(language);
    
    				if (response.code !== 0) {
    					return `Error: ${response.message ?? 'Failed to get speakers'}`;
    				}
    
    				const speakers = response.data?.items ?? [];
    
    				if (speakers.length === 0) {
    					return `No speakers available for language: ${language}`;
    				}
    
    				const speakerTable = speakers
    					.map(
    						(s: Speaker, index: number) =>
    							`${index + 1}. ${s.name}\n   - ID: ${s.speakerId}\n   - Language: ${s.language}\n   - Gender: ${s.gender}\n   - Audio Preview: [🎧 Listen to voice sample](${s.demoAudioUrl})`,
    					)
    					.join('\n\n');
    
    				log.info(`Successfully fetched ${speakers.length} published speakers`);
    				return `Found ${speakers.length} available speakers for language: ${language}\n\nYou can use either the speaker name or speaker ID when creating podcasts.\n\n${speakerTable}`;
    			} catch (error) {
    				const errorMessage = formatError(error);
    				log.error('Failed to get speakers', {error: errorMessage});
    				return `Failed to get speakers: ${errorMessage}`;
    			}
    		},
    	});
    }
  • Top-level call to register all speakers tools (including get_speakers) during overall MCP tools initialization.
    registerSpeakersTools(server, client);
  • Supporting client class method called by the tool handler to perform the actual API request to fetch published speakers filtered by language.
    export class SpeakersClient extends BaseClient {
    	async getSpeakers(
    		language?: string,
    	): Promise<ApiResponse<SpeakersListResponse>> {
    		const parameters: Record<string, any> = {
    			status: SpeakerStatus.PUBLISHED,
    		};
    		if (language) {
    			parameters['language'] = language;
    		}
    
    		const response = await this.axiosInstance.get<
    			ApiResponse<SpeakersListResponse>
    		>('/v1/speakers/list', {params: parameters});
    		return response.data;
    	}
    }
Behavior4/5

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

Annotations indicate readOnlyHint=true and openWorldHint=true, which the description aligns with by describing a retrieval operation. The description adds valuable context beyond annotations: it specifies that speakers are 'published' and 'available,' mentions the default language behavior, and lists the return fields (speaker ID, name, language, gender, demo audio URL). This enhances understanding of what the tool provides without contradicting annotations.

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 efficiently structured in two sentences: the first states the purpose and filtering capability, the second details the return fields and default behavior. Every sentence adds value without redundancy, making it front-loaded and easy to parse for an AI agent.

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?

Given the tool's low complexity (1 optional parameter) and rich annotations (readOnlyHint, openWorldHint), the description is mostly complete. It covers purpose, usage, and output details, though there's no output schema. It could improve by mentioning potential limitations like pagination or error cases, but overall it provides sufficient context for effective tool selection and invocation.

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 'language' parameter fully documented in the schema. The description adds minimal semantics beyond the schema by reiterating filtering by language code and providing examples ('zh', 'en'), but doesn't introduce new parameter insights. With high schema coverage, a baseline score of 3 is appropriate as the description doesn't significantly enhance parameter understanding.

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 the tool's purpose: 'Get list of available published speakers for podcast generation.' It specifies the resource (speakers), the action (get list), and the context (podcast generation). It distinguishes from sibling tools like create_podcast or get_podcast_status by focusing specifically on speaker retrieval rather than podcast creation or status checking.

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

Usage Guidelines4/5

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

The description provides clear context for when to use this tool: for obtaining speakers for podcast generation. It mentions filtering by language code and defaults to Chinese if unspecified, which helps guide usage. However, it doesn't explicitly state when NOT to use it or name alternatives among siblings, such as whether other tools might provide speaker information differently.

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/marswaveai/listenhub-mcp-server'

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