文档 / 成语
成

成语/idiom-mcp/mcp

keyword 可以传成语里的一个字(龙)、完整成语、拼音(wang / wàng zǐ chéng lóng)或释义里的词。接龙给上一句的尾字,同字优先、不够补同音,strict=true 就只认同字。每条都带拼音、释义、出处、例句。

3 个工具7 天调用 —免费 100 次 / 天 / IP

MCP 客户端接入

一行命令,工具自动出现在 Agent 的工具列表里。

bashclaude mcp add
# Claude Code / Cursor / 任何 MCP 客户端
claude mcp add --transport http mycel-idiom https://pianam.cn/idiom-mcp/mcp

HTTP 直连

标准 JSON-RPC 2.0。initialize 握手不消耗额度,只有 tools/call 计数。

bash先看有哪些工具
curl -s https://pianam.cn/idiom-mcp/mcp \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json, text/event-stream' \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'

工具清单

3 个工具,参数与返回结构均来自线上真实响应
01

search_idiom

2 个参数

检索中华成语:keyword 可为成语中的字(如'龙')、完整成语、拼音(如 'wàng zǐ chéng lóng' 或 'wang')或释义/出处关键词。返回成语、拼音、释义、出处、例句。库内收录约3.1万条成语。limit 控制返回条数(1-50,默认10)。

入参

参数类型必填默认说明
keywordstring必填—关键字(成语用字/拼音/释义/出处),如 画蛇添足、long、 比喻
limitinteger可选10返回条数,1-50,默认 10
bash直接 curl 调(真实可跑)
curl -s https://pianam.cn/idiom-mcp/mcp \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json, text/event-stream' \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"search_idiom","arguments":{"keyword":"龙","limit":3}}}'
返回示例(线上真实结果) · 820 字符,点开看
jsonstructuredContent
{
  "success": true,
  "keyword": "龙",
  "total": 3,
  "results": [
    {
      "word": "跑龙套",
      "pinyin": "pǎo lóng tào",
      "explanation": "原指戏曲中拿着旗子做兵卒的角色,后比喻在人手下做无关紧要的事。",
      "derivation": "沈从文《跑龙套》跑龙套在戏台上象是个无固定任务角色,姓名通常不上海报,虽然每一出戏文中大将或寨主出场,他都得前台露面打几个转,而且要严肃认真,不言不笑,凡事照规矩行动,随后才必恭必敬的分站两旁。”",
      "example": "你记得吧,在文工团里时,一唱平戏就叫我~。★邓友梅《追赶队伍的女兵们》三"
    },
    {
      "word": "鳌愤龙愁",
      "pinyin": "áo fèn lóng chóu",
      "explanation": "如鼍愤怒,如龙忧愁。比喻乐曲的情调悲愤。",
      "derivation": "",
      "example": "这是一首~音乐,你想听吗?"
    },
    {
      "word": "白龙鱼服",
      "pinyin": "bái lóng yú fú",
      "explanation": "鱼服穿起鱼的外衣。白龙化为鱼在渊中游。比喻帝王或大官吏隐藏身分,改装出行。",
      "derivation": "汉·刘向《说苑·正谏》昔日龙下清冷之渊,化为鱼,渔者豫且射中其目。” 汉·张衡《东京赋》白龙鱼服,见困豫且。”",
      "example": "相公~,隐姓潜名。倘或途中小辈不识高低,有毁相公者,何以处之?★明·冯梦龙《警世通言》卷四"
    }
  ]
}

total 是本次返回的命中条数(受 limit 约束)。derivation(出处)和 example(例句)都可能是空字符串,解析时别当异常。keyword 也吃拼音:传 long 或 wang 都能命中。

02

idiom_solitaire

3 个参数

成语接龙:输入一个成语(如'一心一意'),返回可以接上的下一个成语列表(以上一成语尾字开头,含拼音、释义)。默认常规模式:优先首尾同字,同字不足时补同音字接龙;strict=True 为严格模式要求首尾必须同字。count 控制返回候选数量(1-20,默认5)。

入参

参数类型必填默认说明
idiomstring必填—起始成语,如 画蛇添足
strictboolean可选falseTrue=严格同字接龙;False=同字优先+同音兜底(默认)
countinteger可选5返回候选成语数量,1-20,默认 5
bash直接 curl 调(真实可跑)
curl -s https://pianam.cn/idiom-mcp/mcp \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json, text/event-stream' \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"idiom_solitaire","arguments":{"idiom":"一心一意","count":5}}}'
返回示例(线上真实结果) · 824 字符,点开看
jsonstructuredContent
{
  "success": true,
  "input": "一心一意",
  "input_pinyin": "yī xīn yī yì",
  "tail_char": "意",
  "tail_pinyin": "yì",
  "mode": "常规模式(优先同字,不足补同音字)",
  "next_count": 5,
  "next": [
    {
      "word": "意气相得",
      "pinyin": "yì qì xiāng dé",
      "explanation": "形容志趣极其相合。",
      "derivation": "唐·李百药《北齐书·高乾传》魏领军元叉,权重当世,以意气相得,接乾甚厚。”",
      "example": ""
    },
    {
      "word": "意在笔先",
      "pinyin": "yì zài bǐ xiān",
      "explanation": "指写字画画,先构思成熟,然后下笔。",
      "derivation": "晋·王羲之《题卫夫人笔阵图后》夫欲书者,先干研墨,凝神静思,预想字形大小,偃仰平直振动,令筋脉相连,意在笔前,然后作字。”",
      "example": "所谓沈郁者,~,神余言外。★清·陈廷焯《白雨斋词话》卷一"
    },
    {
      "word": "意广才疏",
      "pinyin": "yì guǎng cái shū",
      "explanation": "意意愿,志向。志向远大,但才能浅薄。指志大才疏。",
      "derivation": "",
      "example": ""
    }
  ],
  "hint": "可继续用返回成语的最后一个字接龙;strict=True 要求严格同字"
}

线上真实返回 5 个候选,此处截前 3 条。mode 字段写明这次走常规模式还是严格模式;常规模式下同字不够会补同音字,要硬同字就传 strict=true。tail_char 是拿来接龙的尾字,直接喂回 idiom 参数就能连续接。

03

random_idiom

无参数

随机返回一个成语(含拼音、释义、出处、例句),适合每日学成语、接龙开场、写作素材。

入参

无参数。这个工具不需要任何入参,直接调。

bash直接 curl 调(真实可跑)
curl -s https://pianam.cn/idiom-mcp/mcp \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json, text/event-stream' \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"random_idiom","arguments":{}}}'
返回示例(线上真实结果) · 169 字符,点开看
jsonstructuredContent
{
  "success": true,
  "idiom": {
    "word": "镂骨铭肌",
    "pinyin": "lòu gǔ míng jī",
    "explanation": "比喻牢记不忘。多用为感激之词。",
    "derivation": "",
    "example": ""
  }
}

无参数。结构是 {success, idiom}——单个对象不是数组,和 search_idiom 的 results 不一样。

✓

免费额度:每 IP 每天 100 次

超额返回 -32002,带 X-API-Key 继续用。密钥在 pianam.cn 注册后于控制台创建。

接法 ①:MCP 客户端

Claude Code、Cursor、Cherry Studio 等支持 streamable HTTP 的客户端,一行命令把 3 个工具挂到 Agent 上。

bashclaude mcp add
# Claude Code / Cursor / 任何 MCP 客户端
claude mcp add --transport http mycel-idiom https://pianam.cn/idiom-mcp/mcp

接法 ②:直接打 HTTP

端点 https://pianam.cn/idiom-mcp/mcp,POST 一个 JSON-RPC 就返回数据,响应是 SSE(data: 行内是 JSON)。

bash先看工具清单(不消耗额度)
curl -s https://pianam.cn/idiom-mcp/mcp \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json, text/event-stream' \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'
← 回全部端点