[BUG] speech tts synthesize rejects valid locales such as fil-PH, yue-CN and sr-Latn-RS in --language

Open Beginner friendly
#4,356 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

@Shizoqua is already working on this.

Since Dec 4, 2026.

  • #4357 by @Shizoqua — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
azure, csharp

Research direction

Start in tools/Azure.Mcp.Tools.Speech/src/Commands/Tts/TtsSynthesizeCommand.cs and compare its --language validation with LocaleSupport.cs and the sibling STT command. Add or adapt a TtsSynthesizeCommandTests case using a mocked ISpeechService to check valid locales pass and malformed values are rejected. Done means the supplied valid examples reach the service while malformed values still fail validation.

Written by the indexing model from the issue text.

Description

Azure.Mcp.Server needs-triage
Describe the bug

speech tts synthesize rejects valid Azure AI Speech text to speech locales in --language.

tools/Azure.Mcp.Tools.Speech/src/Commands/Tts/TtsSynthesizeCommand.cs validates --language with ^[a-z]{2}-[A-Z]{2}$. That only allows a two-letter language and a two-letter region, so locales with a three-letter language code, a script subtag or a dialect suffix fail validation with 400 before the service is called. Examples: fil-PH, yue-CN, wuu-CN, sr-Latn-RS, zh-CN-sichuan. These are listed in the Speech service language support docs (https://learn.microsoft.com/azure/ai-services/speech-service/language-support?tabs=tts).

The sibling speech stt recognize command accepts the same locales; LocaleSupport.cs in the same area lists fil-PH, yue-CN, wuu-CN, zh-CN-shandong and zh-CN-sichuan.

Expected behavior

--language fil-PH (or yue-CN, wuu-CN, sr-Latn-RS, zh-CN-sichuan) passes validation and is sent to the service, the same as en-US. Malformed values such as invalid, en_US or EN-US are still rejected.

Actual behavior

The command returns 400 with Language must be in format 'xx-XX' (e.g., 'en-US', 'es-ES'). Got: fil-PH and never calls the service.

Reproduction Steps
azmcp speech tts synthesize --endpoint https://example.cognitiveservices.azure.com/ --text "Magandang umaga" --outputAudio out.wav --language fil-PH

Validation fails before any request is made, so no Azure resource or credential is needed to see it. A unit test in TtsSynthesizeCommandTests that passes --language fil-PH with a mocked ISpeechService and asserts 200 fails on current main.

Environment
  • Current main (940504c)
  • Ubuntu 24.04, .NET SDK 10.0.403
Dominant language
C#
Stars
3.9k
Forks
689
Avg merge
2d 11h
Merged PRs (30d)
143

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/mcp

All issues in microsoft/mcp

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.