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

Aperta Adatta ai principianti
#4,356 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

@Shizoqua ci sta già lavorando.

Dal 4/12/2026.

  • #4357 di @Shizoqua — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
azure, csharp

Direzione di ricerca

Inizia da tools/Azure.Mcp.Tools.Speech/src/Commands/Tts/TtsSynthesizeCommand.cs e confronta la convalida di --language con LocaleSupport.cs e il comando STT corrispondente. Aggiungi o adatta un caso di TtsSynthesizeCommandTests che usi un ISpeechService simulato per verificare che le impostazioni locali valide vengano accettate e che i valori malformati siano rifiutati. Il lavoro è completo quando gli esempi validi forniti raggiungono il servizio, mentre i valori malformati continuano a non superare la convalida.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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
Lingua principale
C#
Stelle
3.9k
Fork
689
Merge medio
2g 11h
PR unite (30g)
143

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di microsoft/mcp

Tutte le issue di microsoft/mcp

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.