dingtalk-wiki 1.2.11 → 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.
- package/index.js +34 -7
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1633,6 +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
|
+
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
|
+
}
|
|
1662
|
+
}
|
|
1663
|
+
|
|
1664
|
+
|
|
1665
|
+
|
|
1636
1666
|
const lines = ['🔍 docKey 诊断报告', '', `输入: ${input}`, `operatorId: ${opId}`, ''];
|
|
1637
1667
|
steps.forEach(s => {
|
|
1638
1668
|
lines.push(`--- ${s.step} ---`);
|
|
@@ -1651,15 +1681,12 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
1651
1681
|
lines.push(' 3️⃣ overwriteContent → ❌ 同上错误');
|
|
1652
1682
|
lines.push(' 4️⃣ doc metadata → ❌ 404(该端点不存在)');
|
|
1653
1683
|
lines.push('');
|
|
1654
|
-
lines.push('📌
|
|
1655
|
-
lines.push('
|
|
1656
|
-
lines.push(' (这类文档返回独立的 docKey,与 nodeId/dentryUuid 不同)');
|
|
1657
|
-
lines.push('');
|
|
1658
|
-
lines.push('📌 现有知识库文档内容读写:无公开 REST API 支持');
|
|
1659
|
-
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(临时服务器问题)');
|
|
1660
1686
|
if (effectiveWsId) {
|
|
1661
|
-
lines.push(`
|
|
1687
|
+
lines.push(` 此文档 workspaceId: ${effectiveWsId}`);
|
|
1662
1688
|
}
|
|
1689
|
+
lines.push('📌 请重新运行此工具,已加自动重试逻辑');
|
|
1663
1690
|
|
|
1664
1691
|
return { content: [{ type: 'text', text: lines.join('\n') }] };
|
|
1665
1692
|
}
|