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.
- package/index.js +32 -46
- 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
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
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
|
-
|
|
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('📌
|
|
1697
|
-
lines.push('
|
|
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(`
|
|
1688
|
+
lines.push(` 此文档 workspaceId: ${effectiveWsId}`);
|
|
1704
1689
|
}
|
|
1690
|
+
lines.push('📌 请重新运行此工具,已加自动重试逻辑');
|
|
1705
1691
|
|
|
1706
1692
|
return { content: [{ type: 'text', text: lines.join('\n') }] };
|
|
1707
1693
|
}
|