Skip to main content
Glama

Synthesize speech with OpenAI

openai_text_to_speech

Generate spoken audio from text and save it to a file on disk. Choose voice, speed, and format, then receive the absolute path to the generated audio.

Instructions

Turn text into spoken audio and write the result to disk.

The audio is never returned inline — the tool reports the absolute path of the generated file.

Args:

  • input (string, required): the text to speak, up to 10,000 characters

  • voice (string): voice name, default "alloy"

  • model (string): speech model ID, defaults to OPENAI_DEFAULT_SPEECH_MODEL

  • instructions (string): delivery guidance such as "speak slowly and warmly"

  • format ('mp3'|'opus'|'aac'|'flac'|'wav'|'pcm'): default 'mp3'

  • speed (number): 0.25-4.0, default 1

  • output_path (string): absolute target file, defaults to a timestamped file in OPENAI_MCP_OUTPUT_DIR

  • response_format ('markdown'|'json'): default 'markdown'

Returns (JSON format): { "model": string, "voice": string, "path": string, // absolute path of the written audio file "bytes": number, // file size "format": string // container that was written }

Examples:

  • Use when: "Read this paragraph aloud as an mp3" -> input=

  • Use when: you need a slower narration -> speed=0.85

  • Don't use when: you want a transcript of existing audio (use openai_transcribe_audio)

Error Handling:

  • "Error: Access to ... is not permitted" means output_path is outside OPENAI_MCP_ALLOWED_DIRS

  • "Error: OpenAI rejected the request as invalid" often means the voice name is unknown to that model

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputYesThe text to speak
modelNoSpeech model ID. Defaults to OPENAI_DEFAULT_SPEECH_MODEL.
speedNoPlayback speed multiplier
voiceNoVoice name, e.g. "alloy", "ash", "coral", "sage", "verse", "marin", "cedar"alloy
formatNoAudio container of the generated filemp3
output_pathNoAbsolute file path to write the audio to. Defaults to a timestamped file in OPENAI_MCP_OUTPUT_DIR.
instructionsNoDelivery guidance, e.g. "speak slowly and warmly"
response_formatNoOutput format: 'markdown' or 'json'markdown

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes
bytesYes
modelYes
voiceYes
formatYes

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. First observedv1.0.0

TDQS

A4.8/5.0
Behavior5/5

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

The description discloses important non-obvious behavior beyond the annotations: the audio is never returned inline, the tool writes to disk and reports an absolute path, output_path restrictions produce a specific permission error, and invalid voice names cause a recognizable OpenAI rejection message. This adds meaningful context beyond readOnlyHint, destructiveHint, and openWorldHint.

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

Conciseness4/5

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

The description is longer than average but well organized with clear sections for behavior, arguments, returns, examples, and error handling. The most critical non-obvious fact—audio is never returned inline—is front-loaded. Minor redundancy with the schema keeps it from a perfect score.

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

Completeness5/5

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

With 8 parameters, an output schema, and meaningful annotations, the description still covers everything an agent needs: all parameters and defaults, the return contract, example invocations, and common error conditions. Nothing critical is missing for correct selection and invocation.

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?

Schema coverage is 100%, so the schema already documents all parameters. The description adds value with the 10,000-character limit, output_path default behavior ('timestamped file in OPENAI_MCP_OUTPUT_DIR'), example instructions ('speak slowly and warmly'), and the returned JSON field meanings. Some redundancy exists with the schema, but the extra usage context is helpful.

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 opens with a specific verb and resource: 'Turn text into spoken audio and write the result to disk.' It clearly differentiates from the transcription sibling by stating the direction of conversion, and the tool name/title align with the described behavior.

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

Usage Guidelines5/5

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

The description gives explicit use-when examples such as 'Read this paragraph aloud as an mp3' and an explicit don't-use-when case: 'you want a transcript of existing audio (use openai_transcribe_audio).' This routes the agent to the correct sibling with little ambiguity.

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

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/piorkowskim79/openai-mcp-server'

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