dingtalk-wiki 1.2.12 → 1.2.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +30 -45
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1634,46 +1634,34 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
1634
1634
  }
1635
1635
 
1636
1636
  // Step 10: doc_2.0 API - DocContent (direct dentry content read, async returns taskId)
1637
- try {
1638
- const docContentRes = await axios({
1639
- method: 'GET',
1640
- url: `${DINGTALK_API_V2}/v2.0/doc/dentries/${input}/contents`,
1641
- headers: { 'x-acs-dingtalk-access-token': token },
1642
- params: { operatorId: opId }
1643
- });
1644
- steps.push({
1645
- step: 'doc_2.0 DocContent GET /v2.0/doc/dentries/{uuid}/contents',
1646
- result: '成功',
1647
- raw: docContentRes.data
1648
- });
1649
- } catch (e) {
1650
- steps.push({
1651
- step: 'doc_2.0 DocContent GET /v2.0/doc/dentries/{uuid}/contents',
1652
- result: '失败',
1653
- raw: { message: e.response?.data?.message || e.message, code: e.response?.data?.code || '(无)', status: e.response?.status || '(无)' }
1654
- });
1637
+ for (let attempt = 1; attempt <= 3; attempt++) {
1638
+ try {
1639
+ const docContentRes = await axios({
1640
+ method: 'GET',
1641
+ url: `${DINGTALK_API_V2}/v2.0/doc/dentries/${input}/contents`,
1642
+ headers: { 'x-acs-dingtalk-access-token': token },
1643
+ params: { operatorId: opId }
1644
+ });
1645
+ steps.push({
1646
+ step: `doc_2.0 DocContent (attempt ${attempt})`,
1647
+ result: '成功',
1648
+ raw: docContentRes.data
1649
+ });
1650
+ break;
1651
+ } catch (e) {
1652
+ if (attempt === 3) {
1653
+ steps.push({
1654
+ step: `doc_2.0 DocContent (attempt ${attempt})`,
1655
+ result: '失败',
1656
+ raw: { message: e.response?.data?.message || e.message, code: e.response?.data?.code || '(无)', status: e.response?.status || '(无)' }
1657
+ });
1658
+ } else {
1659
+ await new Promise(r => setTimeout(r, 1000));
1660
+ }
1661
+ }
1655
1662
  }
1656
1663
 
1657
- // Step 11: doc_2.0 API - GetDocContent (another way to get content)
1658
- try {
1659
- const getDocContentRes = await axios({
1660
- method: 'GET',
1661
- url: `${DINGTALK_API_V2}/v2.0/doc/me/query/${input}/contents`,
1662
- headers: { 'x-acs-dingtalk-access-token': token },
1663
- params: { targetFormat: 'markdown' }
1664
- });
1665
- steps.push({
1666
- step: 'doc_2.0 GetDocContent GET /v2.0/doc/me/query/{uuid}/contents',
1667
- result: '成功',
1668
- raw: getDocContentRes.data
1669
- });
1670
- } catch (e) {
1671
- steps.push({
1672
- step: 'doc_2.0 GetDocContent GET /v2.0/doc/me/query/{uuid}/contents',
1673
- result: '失败',
1674
- raw: { message: e.response?.data?.message || e.message, code: e.response?.data?.code || '(无)', status: e.response?.status || '(无)' }
1675
- });
1676
- }
1664
+
1677
1665
 
1678
1666
  const lines = ['🔍 docKey 诊断报告', '', `输入: ${input}`, `operatorId: ${opId}`, ''];
1679
1667
  steps.forEach(s => {
@@ -1693,15 +1681,12 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
1693
1681
  lines.push(' 3️⃣ overwriteContent → ❌ 同上错误');
1694
1682
  lines.push(' 4️⃣ doc metadata → ❌ 404(该端点不存在)');
1695
1683
  lines.push('');
1696
- lines.push('📌 结论:此 dentryUuid 在 Wiki API 中有效,但在 Doc Suite API 中无效。');
1697
- lines.push(' blocks/overwriteContent 仅对通过 create_wiki_doc 创建的文档有效');
1698
- lines.push(' (这类文档返回独立的 docKey,与 nodeId/dentryUuid 不同)');
1699
- lines.push('');
1700
- lines.push('📌 现有知识库文档内容读写:无公开 REST API 支持');
1701
- lines.push(' 若需要读取内容,可用 DingTalk 官方 MCP 服务器的 get_document_content');
1684
+ lines.push('📌 DocContent API (GET /v2.0/doc/dentries/{uuid}/contents) 接受 dentryUuid');
1685
+ lines.push(' 上次失败原因: 503 ServiceUnavailable(临时服务器问题)');
1702
1686
  if (effectiveWsId) {
1703
- lines.push(` - 此文档 workspaceId: ${effectiveWsId}`);
1687
+ lines.push(` 此文档 workspaceId: ${effectiveWsId}`);
1704
1688
  }
1689
+ lines.push('📌 请重新运行此工具,已加自动重试逻辑');
1705
1690
 
1706
1691
  return { content: [{ type: 'text', text: lines.join('\n') }] };
1707
1692
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dingtalk-wiki",
3
- "version": "1.2.12",
3
+ "version": "1.2.13",
4
4
  "description": "DingTalk Wiki / Docs read-write MCP server that fills the gap left by DingTalk official MCP.",
5
5
  "main": "index.js",
6
6
  "bin": {