Skip to main content
Glama
README.md
# dashscope-agent-tools

DashScope / 阿里云百炼 capabilities as **MCP tools** for agent hosts (Claude Code,
Codex, and any MCP-capable harness). Every tool is a thin delegation to the
**official [dashscope](https://github.com/aliyun/dashscope-sdk-python) Python
SDK** — HTTP, signing, retries, and async-task polling all live in the SDK.

> Status: local development, **not yet published** to PyPI or any marketplace.

## v1 capabilities

| Capability | Tools | SDK entry |
| :- | :- | :- |
| Embeddings | `embed_text`, `semantic_search` | `client.embeddings.create` |
| Rerank | `rerank_documents` | `client.rerank.create` |
| Image generation | `generate_image`, `submit_image_task`, `get_image_task`, `cancel_image_task` | `client.images.generate` / `client.images.jobs.*` |
| Speech synthesis (TTS) | `synthesize_speech` | `client.audio.tts.http.synthesize` |
| Speech recognition (ASR) | `transcribe_audio` | `client.audio.asr.transcribe` |
| Video generation | `generate_video`, `submit_video_task`, `get_video_task`, `cancel_video_task` | `client.videos.generate` / `client.videos.jobs.*` |

Default models: `text-embedding-v4`, `gte-rerank-v2`, `wan2.2-t2i-flash`,
`cosyvoice-v2` (voice `longxiaochun_v2`), `qwen-audio-3.1-asr-flash-filetrans`,
`wan2.2-t2v-plus`.

Image URLs are valid for 24 hours; TTS `audio_url` and video `video_url` are
temporary (see `expires_at`) — download them to keep the media. ASR returns a
per-file `transcription_url` (a JSON document); fetch it for the recognized text.

## Credentials

The server reads `DASHSCOPE_API_KEY` from its environment. Get a key at the
[Bailian console](https://bailian.console.aliyun.com/) (API-KEY page).

## Install in Claude Code (after publish)

Two commands, then enter your API key in the install dialog (stored masked in
secure storage, injected into the MCP server env):

```bash
claude plugin marketplace add <owner>/dashscope-agent-tools-python
claude plugin install dashscope@dashscope-agent-tools
```

The plugin (`plugin/`) ships Skills that tell Claude when to use each tool
(image generation, semantic search, reranking, text-to-speech, transcription,
video generation) plus the MCP server config.

## Other MCP hosts

The package is a plain stdio MCP server — no Claude-specific code. Generic
config (Claude Desktop, Cursor, Cline, OpenClaw, ...):

```json
{
  "mcpServers": {
    "dashscope": {
      "command": "uvx",
      "args": ["dashscope-agent-tools"],
      "env": { "DASHSCOPE_API_KEY": "sk-..." }
    }
  }
}
```

Codex (`~/.codex/config.toml`):

```toml
[mcp_servers.dashscope]
command = "uvx"
args = ["dashscope-agent-tools"]
```

Without `uv`, use `pip install dashscope-agent-tools` and set
`command` to `dashscope-agent-tools` (or `python -m dashscope_agent_tools`).

## Development

```bash
uv venv --python 3.12 .venv
uv pip install -p .venv/bin/python -e ".[dev]"
.venv/bin/pytest tests/ -q          # offline tests, mocked SDK
.venv/bin/python tests/smoke_real.py  # real API smoke (needs DASHSCOPE_API_KEY)
# video render is billed and opt-in: DASHSCOPE_SMOKE_VIDEO=1 .venv/bin/python tests/smoke_real.py
.venv/bin/python tests/plugin_structure_check.py  # plugin structure (no claude CLI needed)
claude plugin validate ./plugin
claude --plugin-dir ./plugin        # load the plugin for one session
```

For local plugin runs before PyPI publish, point `plugin/.mcp.json` at the
repo venv binary (`.venv/bin/dashscope-agent-tools`) instead of `uvx`.

## Layout

```
src/dashscope_agent_tools/   # tools.py (SDK delegation), server.py (MCP), errors.py
plugin/                      # Claude Code plugin: manifest, skills, .mcp.json
.claude-plugin/marketplace.json
tests/                       # offline mock tests + real-API smoke
```

TDQS

A3.7/5.0

Scored across 13 tools

Disambiguation4/5

Most tools map to a distinct model capability (embed, rerank, image, video, TTS, ASR), and the image/video lifecycle tools are cleanly separated. The only real overlap is between semantic_search and rerank_documents (both order documents by query relevance), but the descriptions explicitly contrast them (embedding similarity vs. dedicated rerank).

Naming Consistency5/5

Every name is snake_case verb_noun: embed_text, generate_image, submit_image_task, get_image_task, cancel_image_task, generate_video, submit_video_task, cancel_video_task, synthesize_speech, transcribe_audio. The async lifecycle trio (generate/submit/get/cancel) follows an identical pattern across image and video, making the set highly predictable.

Tool Count5/5

13 tools cover five modalities with well-earned extras for async image/video control. No filler: each tool corresponds to a genuine operation (sync variant, async submit, poll, cancel, or core inference).

Completeness4/5

Image and video generation have full sync/async/poll/cancel lifecycles, and embeddings, rerank, TTS, and ASR are present. Gaps are minor: there is no list_tasks to enumerate pending image/video tasks, no cancellation path for TTS/ASR, and no text-generation (LLM completion) tool despite that being a core DashScope capability.

Maintenance

ActivityNo data
ResponsivenessNo recent community issues