SKILL.md
Sarvam MCP
Drive sarvam-mcp. Prefer MCP tools over inventing HTTP/SDK calls for live work.
Procedure
Copy and track:
- [ ] 1. MCP available? If no → read references/install.md (or fall back to SDK skills)
- [ ] 2. Namespace: live action → sarvam_tools_*; write/lookup code → sarvam_code_*
- [ ] 3. Prefer a composite if the task spans STT/translate/TTS/LLM
- [ ] 4. Call the tool (absolute paths; BCP-47 codes)
- [ ] 5. On auth error → sarvam_tools_set_api_key; on param error → fix and retry
- [ ] 6. Return the result path/text; mention observability only if debugging
1. Namespace (mandatory)
| User wants… | Namespace | Example |
|---|---|---|
| Sarvam to do it now | sarvamtools* |
"Translate this to Tamil" |
| Help writing code / API facts | sarvamcode* |
"How do I call TTS from Python?" |
Never use sarvamcode for a live translate/TTS/STT request. Never burn sarvamtools credits just to draft code unless the user asked for a live demo.
2. Pick the tool (defaults)
Composites first — do not hand-chain STT → translate → TTS:
| Task | Tool |
|---|---|
| Spoken reply to audio | sarvamtoolsvoice |
| Dub into another Indic language | sarvamtoolsdub |
| Localize JSON/YAML/PO/etc. | sarvamtoolslocalize |
| Q&A / summary over audio | sarvamtoolsrecall |
Atomic runtime (use when no composite fits):
| Task | Tool |
|---|---|
| Transcribe | sarvamtoolsstt_transcribe |
| Speech → English | sarvamtoolsstt_translate |
| Audio >~30s / diarization | sarvamtoolssttbatchsubmit → sttbatch_status |
| Speak text | sarvamtoolstts_speak |
| Translate text | sarvamtoolstranslate |
| Transliterate / LID / analytics | sarvamtoolstransliterate / identifylanguage / textanalytics |
| Chat complete | sarvamtoolsllm_complete |
| Document intelligence | sarvamtoolsvisionextract → visionjobstatus |
| Pronunciation dicts | sarvamtoolspronunciation_* |
| Set / rotate API key | sarvamtoolssetapikey |
Build-time (coding help):
| Task | Tool |
|---|---|
| Unsure which model/lang | sarvamcoderecommend_model |
| Endpoint shape | sarvamcodeapi_reference |
| Snippet | sarvamcodesnippet |
| Speakers / languages | sarvamcodespeakers / _languages |
| Validate draft body | sarvamcodevalidate_request |
| Docs search / pricing | sarvamcodesearchdocs / pricing |
Coding flow: recommendmodel → snippet or apireference → validate_request.
For parameters and env knobs, read [references/tools.md](references/tools.md).
3. Defaults (use unless user overrides)
| Setting | Default |
|---|---|
| STT model | saaras:v3 |
| TTS model / speaker | bulbul:v3 / priya |
| LLM | sarvam-30b (use sarvam-105b for hard reasoning) |
| Translate model | mayura:v1 (switch to sarvam-translate:v1 for broader Indic coverage) |
| Audio path | Absolute local path |
| Language codes | BCP-47 (hi-IN, ta-IN, od-IN not or-IN) |
4. Auth
Key sources (env wins): SARVAMAPIKEY, or ~/.sarvam/credentials (apikey = sk...).
Dashboard: https://dashboard.sarvam.ai/key-management
On auth failure:
sarvamtoolssetapikeywith emptyapi_key→ instructions + link- Call again with
sk_...→ persists to~/.sarvam/credentials
Wire auth is api-subscription-key — never invent Authorization: Bearer.
Examples
Live translate
User: "Translate 'Good morning' to Hindi."
→ sarvamtoolstranslate with input, sourcelanguagecode=en-IN, targetlanguagecode=hi-IN. Return translated_text.
Live TTS
User: "Say नमस्ते in Hindi."
→ sarvamtoolsttsspeak with native-script text, targetlanguage_code=hi-IN, speaker=priya. Return the audio path.
Dub
User: "Dub this clip into Tamil" + path.
→ sarvamtoolsdub with audiopath, targetlanguage_code=ta-IN — not STT + translate + TTS separately.
Code help
User: "Show a Python TTS example."
→ sarvamcodesnippet with api=tts, language=python (not sarvamtoolstts_speak unless they want audio now).
Gotchas
| Mistake agents make | Correct behavior |
|---|---|
Invent curl/SDK for a live ask |
Call sarvamtools* when MCP is connected |
| Hand-chain STT→translate→TTS | Use voice / dub / localize / recall |
| REST STT on long files | Use sttbatch* above ~30s |
| TTS target outside ~11 langs | Check with sarvamcodelanguages (api=tts); STT has ~23 |
| v2 speaker on Bulbul v3 | Use priya/shubh or sarvamcodespeakers |
pitch / loudness on v3 |
Only pace (0.5–2.0) |
| Romanized Indic for TTS | Prefer native script |
output_script on sarvam-translate:v1 |
mayura:v1 only |
| Relative audio paths | Prefer absolute paths; or audiobase64/audiourl + filename |
| Assume output cwd | Files go under SARVAMMCPBASE_PATH (default ~/Desktop) unless tool returns another path |
Stale tool names without tools/code |
Match the connected server's tool list |
When MCP is missing
- Read [references/install.md](references/install.md) and help the user connect the server.
- If they only need code: use sibling skills
translate,speech-to-text,text-to-speech,chat, or https://docs.sarvam.ai/llms.txt.
References (load on demand)
| File | Read when |
|---|---|
| [references/install.md](references/install.md) | MCP not connected, setup/troubleshoot, or user names a client |
| [references/tools.md](references/tools.md) | Choosing parameters, env vars, or an uncommon tool |