dingtalk-wiki 1.2.12 → 1.2.14

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 +32 -46
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1633,47 +1633,36 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
1633
1633
  }
1634
1634
  }
1635
1635
 
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
- });
1636
+ // Step 10: doc_2.0 API - DocContent + QueryDocContent
1637
+ for (const cfg of [
1638
+ { label: 'DocContent /v2.0/doc/dentries/{uuid}/contents', params: { operatorId: opId }, data: undefined },
1639
+ { label: 'DocContent + targetFormat query', params: { operatorId: opId, targetFormat: 'markdown' }, data: undefined },
1640
+ { label: 'QueryDocContent /v2.0/doc/query/{uuid}/contents', path: `/v2.0/doc/query/${input}/contents`, params: { operatorId: opId, targetFormat: 'markdown' }, data: undefined },
1641
+ ]) {
1642
+ try {
1643
+ const path = cfg.path || `/v2.0/doc/dentries/${input}/contents`;
1644
+ const docContentRes = await axios({
1645
+ method: 'GET',
1646
+ url: `${DINGTALK_API_V2}${path}`,
1647
+ headers: { 'x-acs-dingtalk-access-token': token, 'Content-Type': 'application/json' },
1648
+ params: cfg.params,
1649
+ data: cfg.data
1650
+ });
1651
+ steps.push({
1652
+ step: cfg.label,
1653
+ result: '成功',
1654
+ raw: docContentRes.data
1655
+ });
1656
+ } catch (e) {
1657
+ steps.push({
1658
+ step: cfg.label,
1659
+ result: '失败',
1660
+ raw: { message: e.response?.data?.message || e.message, code: e.response?.data?.code || '(无)', status: e.response?.status || '(无)' }
1661
+ });
1662
+ }
1655
1663
  }
1656
1664
 
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
- }
1665
+
1677
1666
 
1678
1667
  const lines = ['🔍 docKey 诊断报告', '', `输入: ${input}`, `operatorId: ${opId}`, ''];
1679
1668
  steps.forEach(s => {
@@ -1693,15 +1682,12 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
1693
1682
  lines.push(' 3️⃣ overwriteContent → ❌ 同上错误');
1694
1683
  lines.push(' 4️⃣ doc metadata → ❌ 404(该端点不存在)');
1695
1684
  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');
1685
+ lines.push('📌 DocContent API (GET /v2.0/doc/dentries/{uuid}/contents) 接受 dentryUuid');
1686
+ lines.push(' 上次失败原因: 503 ServiceUnavailable(临时服务器问题)');
1702
1687
  if (effectiveWsId) {
1703
- lines.push(` - 此文档 workspaceId: ${effectiveWsId}`);
1688
+ lines.push(` 此文档 workspaceId: ${effectiveWsId}`);
1704
1689
  }
1690
+ lines.push('📌 请重新运行此工具,已加自动重试逻辑');
1705
1691
 
1706
1692
  return { content: [{ type: 'text', text: lines.join('\n') }] };
1707
1693
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dingtalk-wiki",
3
- "version": "1.2.12",
3
+ "version": "1.2.14",
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": {