@hiai-gg/docsmint 1.0.3 → 2.0.3
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/README.md +19 -4
- package/dist/backend/index.js +14297 -12972
- package/dist/frontend/{CategoryDialog-B1yQFy54.js → CategoryDialog-CJeAYxcd.js} +7 -7
- package/dist/frontend/{ConfirmDialog-9N3dJGHt.js → ConfirmDialog-B1MjKlVQ.js} +5 -5
- package/dist/frontend/{CreateSnapshotDialog-CR5BHpsb.js → CreateSnapshotDialog-BTMoPFdj.js} +4 -4
- package/dist/frontend/{DatePicker-B7p5pH4-.js → DatePicker-Bmjko3X7.js} +12 -12
- package/dist/frontend/{DeleteDialog-BqR7AQrP.js → DeleteDialog-BkfIeKXO.js} +3 -3
- package/dist/frontend/{FolderNode-BQcEuZe3.js → FolderNode-Do8pIfyA.js} +4 -4
- package/dist/frontend/{FolderTreeSelector-DqO-f0nt.js → FolderTreeSelector-FyxhcHjr.js} +3 -3
- package/dist/frontend/{HiAiEditor-BFpfeft6.js → HiAiEditor-DDpfdQEg.js} +38 -38
- package/dist/frontend/{Icon-y7xxAIC6.js → Icon-3EYzvNyk.js} +1 -1
- package/dist/frontend/{SettingsDialog-eyTOtZcw.js → SettingsDialog-DzlYW50I.js} +18 -18
- package/dist/frontend/{ShareDialog-gCbk5Rrv.js → ShareDialog-Ddvl7xvb.js} +1 -1
- package/dist/frontend/{Sidebar-3ridIx_X.js → Sidebar-rFiVen96.js} +29 -29
- package/dist/frontend/{TagCreateDialog-B0M1gqk6.js → TagCreateDialog-DQmMJe_E.js} +5 -5
- package/dist/frontend/api/categories.js +1 -1
- package/dist/frontend/api/settings.js +1 -1
- package/dist/frontend/api/tags.js +1 -1
- package/dist/frontend/app-shell.js +6 -6
- package/dist/frontend/{auth-client-DuY45VqK.js → auth-client-CXR-7mIO.js} +11 -11
- package/dist/frontend/{camera-BI-BtnIm.js → camera-DtgHzfVI.js} +2 -2
- package/dist/frontend/{categories-Bjcc41We.js → categories-C8AAkhCR.js} +1 -1
- package/dist/frontend/{check-sdTlLwi9.js → check-DVx65aSv.js} +2 -2
- package/dist/frontend/{chevron-down-DlBnIE7Y.js → chevron-down-C2tbZ8Ol.js} +2 -2
- package/dist/frontend/{circle-check-hWC-HeKu.js → circle-check-BAN-D7yg.js} +2 -2
- package/dist/frontend/{clock-C4FHq-9q.js → clock-ByiB0SwQ.js} +2 -2
- package/dist/frontend/components/category-dialog.js +1 -1
- package/dist/frontend/components/create-snapshot-dialog.js +1 -1
- package/dist/frontend/components/delete-dialog.js +1 -1
- package/dist/frontend/components/editor/compact-editor.js +1 -1
- package/dist/frontend/components/editor/document-editor.js +1 -1
- package/dist/frontend/components/editor/markdown-toggle.js +2 -2
- package/dist/frontend/components/folder-node.js +1 -1
- package/dist/frontend/components/folder-tree-selector.js +1 -1
- package/dist/frontend/components/save-as-dialog.js +7 -7
- package/dist/frontend/components/settings.js +1 -1
- package/dist/frontend/components/share-dialog.js +1 -1
- package/dist/frontend/components/sidebar.js +1 -1
- package/dist/frontend/components/tag-create-dialog.js +1 -1
- package/dist/frontend/components/version-history.js +10 -10
- package/dist/frontend/{copy-4H99lwAQ.js → copy-CRzvfZGb.js} +2 -2
- package/dist/frontend/dashboard.js +48 -48
- package/dist/frontend/{db-rWMRdDfv.js → db-Dya0HRhS.js} +1 -1
- package/dist/frontend/{dialog-dq74xSum.js → dialog-a_ZcpEC5.js} +9 -9
- package/dist/frontend/{dist-BUuz1oVW.js → dist-CcHOStsA.js} +1 -1
- package/dist/frontend/dist-DcHl92QO.js +316 -0
- package/dist/frontend/{dndzone-BrakBHwm.js → dndzone-CDhrbpTg.js} +1 -1
- package/dist/frontend/{dropdown-menu-ChtRLf5S.js → dropdown-menu-DrHYReIC.js} +12 -12
- package/dist/frontend/{ellipsis-vertical-CObXWXZW.js → ellipsis-vertical-qxNgoXu-.js} +2 -2
- package/dist/frontend/{folder-BAX6qBYy.js → folder-D74E-Kdp.js} +3 -3
- package/dist/frontend/frontend.css +1 -1
- package/dist/frontend/{identity-BCcv0x22.js → identity-BOA7Jejv.js} +1 -1
- package/dist/frontend/{input-DTrIztSF.js → input-Q_7qCfnU.js} +2 -2
- package/dist/frontend/{label-BidWF619.js → label-Dj8FDEhf.js} +2 -2
- package/dist/frontend/{loader-circle-DnyUzAmN.js → loader-circle-D3t5NkvC.js} +2 -2
- package/dist/frontend/offline/identity.js +1 -1
- package/dist/frontend/{popper-layer-force-mount-DeBbICF4.js → popper-layer-force-mount-CNtiLgbV.js} +63 -63
- package/dist/frontend/{rotate-ccw-DtZDfSK3.js → rotate-ccw-B1ybQ8oQ.js} +2 -2
- package/dist/frontend/schemas-1Na35n71.js +3988 -0
- package/dist/frontend/search.js +13 -13
- package/dist/frontend/{select-value-BlBmN1Vp.js → select-value-BkI1W1bn.js} +19 -19
- package/dist/frontend/{settings-BsuxLoxv.js → settings-BRcYFQa_.js} +1 -1
- package/dist/frontend/{share-context-CX9pmtDz.js → share-context-BJ4GF4yT.js} +8 -8
- package/dist/frontend/{tag-ChpMfbfa.js → tag-qbTBLj-g.js} +3 -3
- package/dist/frontend/{tags-CzPNUoFw.js → tags-CF_cqzSV.js} +1 -1
- package/dist/frontend/{textarea-704DccHJ.js → textarea-BNK0LFUK.js} +2 -2
- package/dist/frontend/theme.js +1 -1
- package/dist/frontend/{theme.svelte-B6hsI5me.js → theme.svelte-BRdxXd-B.js} +3 -3
- package/dist/frontend/utils/dndzone.js +1 -1
- package/dist/frontend/{utils-j7qLkF4C.js → utils-BlHvR6OL.js} +1 -1
- package/dist/frontend/{x-B2ifxSH7.js → x-CvSSnrjl.js} +2 -2
- package/dist/frontend-ssr/api/settings.js +1 -1
- package/dist/frontend-ssr/app-shell.js +6 -6
- package/dist/frontend-ssr/assets/{CategoryDialog-Ch4RlhLg.js → CategoryDialog-DuZLLlt7.js} +7 -7
- package/dist/frontend-ssr/assets/{ConfirmDialog-B9sc7xt5.js → ConfirmDialog-0WVu9BCE.js} +8 -8
- package/dist/frontend-ssr/assets/{CreateSnapshotDialog-XLsNLzRf.js → CreateSnapshotDialog-3vhDTFNu.js} +4 -4
- package/dist/frontend-ssr/assets/{DatePicker-BwLyP3b_.js → DatePicker-t12leL2Y.js} +7 -7
- package/dist/frontend-ssr/assets/{DeleteDialog-C0a-RBKC.js → DeleteDialog-B0AU1fJR.js} +3 -3
- package/dist/frontend-ssr/assets/{FolderNode-imYW-MNe.js → FolderNode-C-B-s8x1.js} +5 -5
- package/dist/frontend-ssr/assets/{FolderTreeSelector-DnrKCYtl.js → FolderTreeSelector-DdQuEcj0.js} +4 -4
- package/dist/frontend-ssr/assets/{HiAiEditor-CXq29oHf.js → HiAiEditor-Bj6tiE97.js} +30 -30
- package/dist/frontend-ssr/assets/{Icon-Clqe8D8X.js → Icon-DE_3EnuF.js} +4 -4
- package/dist/frontend-ssr/assets/{SettingsDialog-CH5B9IOK.js → SettingsDialog-h4SFwpUa.js} +16 -16
- package/dist/frontend-ssr/assets/{ShareDialog-CcKZFHo8.js → ShareDialog-CpE9zd_f.js} +1 -1
- package/dist/frontend-ssr/assets/{Sidebar-DQcwbR0y.js → Sidebar-BFBpsd3L.js} +26 -26
- package/dist/frontend-ssr/assets/{TagCreateDialog-DCz6I-FH.js → TagCreateDialog-DBHO1DPU.js} +4 -4
- package/dist/frontend-ssr/assets/{auth-client-CokKgEB-.js → auth-client-BC4hSFKF.js} +13 -13
- package/dist/frontend-ssr/assets/{camera-Dwwtgvfn.js → camera-B6ldo_Js.js} +2 -2
- package/dist/frontend-ssr/assets/{chevron-down-C6BTPJFz.js → chevron-down-DQcr6JUc.js} +2 -2
- package/dist/frontend-ssr/assets/{chevron-right-CseGE1qd.js → chevron-right-9szrliZx.js} +2 -2
- package/dist/frontend-ssr/assets/{circle-check-BRhWPZo1.js → circle-check-BgP9MRRv.js} +2 -2
- package/dist/frontend-ssr/assets/{clock-DpP_Y7WP.js → clock-roNtGlT6.js} +2 -2
- package/dist/frontend-ssr/assets/{copy-DRMKiRZ0.js → copy-BYqYnBIQ.js} +2 -2
- package/dist/frontend-ssr/assets/{db-BxaCyM9B.js → db-C3rFdTZa.js} +1 -1
- package/dist/frontend-ssr/assets/{dialog-Bjm7PhCc.js → dialog-SqCnTT43.js} +9 -9
- package/dist/frontend-ssr/assets/{dist-71eunluk.js → dist-CaZQ1FhA.js} +10 -10
- package/dist/frontend-ssr/assets/{dist-CshZmNmp.js → dist-CqxHwOlp.js} +3 -3
- package/dist/frontend-ssr/assets/{dndzone-WtNaDxoQ.js → dndzone-CnTCMhPd.js} +1 -1
- package/dist/frontend-ssr/assets/{dropdown-menu-dg8hpDGz.js → dropdown-menu-CE6U0f1b.js} +12 -12
- package/dist/frontend-ssr/assets/{ellipsis-vertical-BErUuhWg.js → ellipsis-vertical-Cg1MrZsl.js} +2 -2
- package/dist/frontend-ssr/assets/{folder-DszunwKc.js → folder-DHB-CEcQ.js} +2 -2
- package/dist/frontend-ssr/assets/{identity-BHNrcgU5.js → identity-DNIo1bgc.js} +1 -1
- package/dist/frontend-ssr/assets/{input-BzlpgSwc.js → input-DVrBVPgs.js} +2 -2
- package/dist/frontend-ssr/assets/{label-uycYYCYF.js → label-vtCK3pTp.js} +2 -2
- package/dist/frontend-ssr/assets/{loader-circle-BpRVrMZg.js → loader-circle-D3NWhCif.js} +2 -2
- package/dist/frontend-ssr/assets/{popper-layer-force-mount-X3deg3KH.js → popper-layer-force-mount-C4dMMt-f.js} +71 -71
- package/dist/frontend-ssr/assets/{rotate-ccw-1GOD_yt_.js → rotate-ccw-DNf3nwMD.js} +2 -2
- package/dist/frontend-ssr/assets/{select-value-BRQxTiFP.js → select-value-Ce5c_fuA.js} +18 -18
- package/dist/frontend-ssr/assets/{settings-Dy4eZk45.js → settings-DWCpfCPj.js} +1 -1
- package/dist/frontend-ssr/assets/{share-context-dIAQ413Z.js → share-context-B4UpvTSw.js} +9 -9
- package/dist/frontend-ssr/assets/{tag-DFh6nF9R.js → tag-Cqv0fWVG.js} +3 -3
- package/dist/frontend-ssr/assets/{textarea-CEUFQIma.js → textarea-BdjOJJVb.js} +2 -2
- package/dist/frontend-ssr/assets/{theme.svelte-dM8TietK.js → theme.svelte-D6bbaJ9m.js} +3 -3
- package/dist/frontend-ssr/assets/{utils-0rlYZMNr.js → utils-D3X7I8nz.js} +1 -1
- package/dist/frontend-ssr/components/category-dialog.js +1 -1
- package/dist/frontend-ssr/components/create-snapshot-dialog.js +1 -1
- package/dist/frontend-ssr/components/delete-dialog.js +1 -1
- package/dist/frontend-ssr/components/editor/compact-editor.js +1 -1
- package/dist/frontend-ssr/components/editor/document-editor.js +1 -1
- package/dist/frontend-ssr/components/editor/markdown-toggle.js +1 -1
- package/dist/frontend-ssr/components/folder-node.js +1 -1
- package/dist/frontend-ssr/components/folder-tree-selector.js +1 -1
- package/dist/frontend-ssr/components/save-as-dialog.js +6 -6
- package/dist/frontend-ssr/components/settings.js +1 -1
- package/dist/frontend-ssr/components/share-dialog.js +1 -1
- package/dist/frontend-ssr/components/sidebar.js +1 -1
- package/dist/frontend-ssr/components/tag-create-dialog.js +1 -1
- package/dist/frontend-ssr/components/version-history.js +10 -10
- package/dist/frontend-ssr/dashboard.js +40 -40
- package/dist/frontend-ssr/offline/identity.js +1 -1
- package/dist/frontend-ssr/search.js +8 -8
- package/dist/frontend-ssr/theme.js +1 -1
- package/dist/frontend-ssr/utils/dndzone.js +1 -1
- package/dist/lifecycle-runtime.js +7129 -1986
- package/dist/mcp-cli.js +133 -72
- package/dist/mcp-server.d.ts +15 -0
- package/dist/mcp-server.js +137 -72
- package/package.json +15 -6
- package/packages/cli/src/index.ts +1 -1
- package/server.json +2 -2
- package/dist/frontend/dist-COPpfjrc.js +0 -316
- package/dist/frontend/schemas-CdPhcuru.js +0 -3001
package/dist/mcp-cli.js
CHANGED
|
@@ -575,9 +575,6 @@ var RESOURCE_PERMISSIONS = new Set([
|
|
|
575
575
|
"edit",
|
|
576
576
|
"write"
|
|
577
577
|
]);
|
|
578
|
-
// ../mcp-server/src/compact.ts
|
|
579
|
-
import { z as z3 } from "zod";
|
|
580
|
-
|
|
581
578
|
// ../mcp-server/src/output-schemas.ts
|
|
582
579
|
import { z } from "zod";
|
|
583
580
|
var tagSchema = z.looseObject({
|
|
@@ -806,7 +803,7 @@ var operationOutputSchemas = {
|
|
|
806
803
|
permanently_delete_document: deleteAcknowledgmentSchema
|
|
807
804
|
};
|
|
808
805
|
var variant = (operation, result) => z.object({ operation: z.literal(operation), result });
|
|
809
|
-
var
|
|
806
|
+
var singleToolOutputSchemas = {
|
|
810
807
|
delete_document: operationOutputSchemas.delete_document,
|
|
811
808
|
delete_folder: operationOutputSchemas.delete_folder,
|
|
812
809
|
delete_category: operationOutputSchemas.delete_category,
|
|
@@ -832,6 +829,7 @@ var toolOutputSchemas = {
|
|
|
832
829
|
variant("update", operationOutputSchemas.update_document)
|
|
833
830
|
]),
|
|
834
831
|
list_workspace_structure: z.union([
|
|
832
|
+
variant("workspaces", z.array(z.object({ id: z.string().uuid(), name: z.string(), slug: z.string(), entireWorkspace: z.boolean(), categoryIds: z.array(z.string().uuid()) }))),
|
|
835
833
|
variant("folders", operationOutputSchemas.list_folders),
|
|
836
834
|
variant("categories", operationOutputSchemas.list_categories),
|
|
837
835
|
variant("tags", operationOutputSchemas.list_tags)
|
|
@@ -874,9 +872,27 @@ var toolOutputSchemas = {
|
|
|
874
872
|
variant("tag", tagSchema)
|
|
875
873
|
])
|
|
876
874
|
};
|
|
875
|
+
var workspaceSchema = z.object({ id: z.string().uuid(), name: z.string(), slug: z.string() });
|
|
876
|
+
var scoped = (data) => z.object({
|
|
877
|
+
operation: z.string(),
|
|
878
|
+
scopedResults: z.array(z.object({ workspace: workspaceSchema, categoryId: z.string().uuid().nullable(), data }))
|
|
879
|
+
});
|
|
880
|
+
var scopedSchemas = {
|
|
881
|
+
find_documents: scoped(singleToolOutputSchemas.find_documents),
|
|
882
|
+
list_workspace_structure: scoped(singleToolOutputSchemas.list_workspace_structure),
|
|
883
|
+
list_trash: scoped(singleToolOutputSchemas.list_trash)
|
|
884
|
+
};
|
|
885
|
+
var toolOutputSchemas = {
|
|
886
|
+
...singleToolOutputSchemas,
|
|
887
|
+
find_documents: z.union([...singleToolOutputSchemas.find_documents.options, scopedSchemas.find_documents]),
|
|
888
|
+
list_workspace_structure: z.union([...singleToolOutputSchemas.list_workspace_structure.options, scopedSchemas.list_workspace_structure]),
|
|
889
|
+
list_trash: z.union([singleToolOutputSchemas.list_trash, scopedSchemas.list_trash])
|
|
890
|
+
};
|
|
891
|
+
// ../mcp-server/src/compact.ts
|
|
892
|
+
import { z as z4 } from "zod";
|
|
877
893
|
|
|
878
894
|
// ../mcp-server/src/batch-workspace.ts
|
|
879
|
-
import { z as
|
|
895
|
+
import { z as z3 } from "zod";
|
|
880
896
|
|
|
881
897
|
// ../mcp-server/src/client.ts
|
|
882
898
|
var DEFAULT_BASE_URL = "http://localhost:50700";
|
|
@@ -971,6 +987,7 @@ var client = new Proxy({}, {
|
|
|
971
987
|
});
|
|
972
988
|
|
|
973
989
|
// ../mcp-server/src/client-routing-schema.ts
|
|
990
|
+
import { z as z2 } from "zod";
|
|
974
991
|
function hoistObjectUnionClosure(schema) {
|
|
975
992
|
const variants = schema.oneOf;
|
|
976
993
|
if (!Array.isArray(variants) || !variants.every((variant2) => typeof variant2 === "object" && variant2 !== null && variant2.type === "object" && variant2.additionalProperties === false && typeof variant2.properties === "object" && variant2.properties !== null))
|
|
@@ -1006,29 +1023,55 @@ function hoistObjectUnionClosure(schema) {
|
|
|
1006
1023
|
}
|
|
1007
1024
|
function withClientRoutingSchema(schema) {
|
|
1008
1025
|
const standard = schema["~standard"];
|
|
1026
|
+
const selector = z2.string().uuid().optional().describe("Workspace UUID from list_workspace_structure(kind=workspaces). Required for ambiguous creates and structure changes; omit to search all granted scopes.");
|
|
1009
1027
|
return {
|
|
1010
1028
|
"~standard": {
|
|
1011
1029
|
...standard,
|
|
1030
|
+
validate: async (value, options) => {
|
|
1031
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
1032
|
+
return standard.validate(value, options);
|
|
1033
|
+
const { workspaceId, ...args } = value;
|
|
1034
|
+
const selected = selector.safeParse(workspaceId);
|
|
1035
|
+
if (!selected.success)
|
|
1036
|
+
return { issues: selected.error.issues };
|
|
1037
|
+
const validated = await standard.validate(args, options);
|
|
1038
|
+
if (validated.issues)
|
|
1039
|
+
return validated;
|
|
1040
|
+
return { value: { ...validated.value, ...selected.data ? { workspaceId: selected.data } : {} } };
|
|
1041
|
+
},
|
|
1012
1042
|
jsonSchema: {
|
|
1013
1043
|
...standard.jsonSchema,
|
|
1014
|
-
input: (options) =>
|
|
1044
|
+
input: (options) => (() => {
|
|
1045
|
+
const published = hoistObjectUnionClosure(standard.jsonSchema.input(options));
|
|
1046
|
+
const routingProperty = z2.toJSONSchema(selector);
|
|
1047
|
+
return {
|
|
1048
|
+
...published,
|
|
1049
|
+
properties: { ...published.properties, workspaceId: routingProperty },
|
|
1050
|
+
...Array.isArray(published.oneOf) ? {
|
|
1051
|
+
oneOf: published.oneOf.map((branch) => ({
|
|
1052
|
+
...branch,
|
|
1053
|
+
properties: { ...branch.properties, workspaceId: routingProperty }
|
|
1054
|
+
}))
|
|
1055
|
+
} : {}
|
|
1056
|
+
};
|
|
1057
|
+
})()
|
|
1015
1058
|
}
|
|
1016
1059
|
}
|
|
1017
1060
|
};
|
|
1018
1061
|
}
|
|
1019
1062
|
|
|
1020
1063
|
// ../mcp-server/src/batch-workspace.ts
|
|
1021
|
-
var uuid =
|
|
1022
|
-
var documentIds =
|
|
1064
|
+
var uuid = z3.string().uuid().describe("UUID of an item visible to the active API key.");
|
|
1065
|
+
var documentIds = z3.array(uuid).min(1).max(25).refine((ids) => new Set(ids).size === ids.length, "Document IDs must be unique.").describe("One to 25 distinct document UUIDs, explicitly selected by the user; no search expansion.");
|
|
1023
1066
|
var base = { documentIds };
|
|
1024
|
-
var batchInput =
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1067
|
+
var batchInput = z3.discriminatedUnion("action", [
|
|
1068
|
+
z3.strictObject({ ...base, action: z3.literal("move").describe("Move each document to the same folder."), folderId: uuid.nullable().describe("Destination folder UUID, or null for no folder.") }),
|
|
1069
|
+
z3.strictObject({ ...base, action: z3.literal("set_category").describe("Set one explicit category on every document."), categoryId: uuid.nullable().describe("Category UUID, or null to clear explicit category.") }),
|
|
1070
|
+
z3.strictObject({ ...base, action: z3.literal("add_tag").describe("Assign one existing tag to every document."), tagId: uuid.describe("Existing tag UUID to assign to each document.") }),
|
|
1071
|
+
z3.strictObject({ ...base, action: z3.literal("remove_tag").describe("Remove one tag assignment from every document."), tagId: uuid.describe("Existing tag UUID to unassign from each document.") }),
|
|
1072
|
+
z3.strictObject({ ...base, action: z3.literal("trash").describe("Move every document to trash without permanent deletion.") }),
|
|
1073
|
+
z3.strictObject({ ...base, action: z3.literal("restore").describe("Restore every selected document from trash.") }),
|
|
1074
|
+
z3.strictObject({ ...base, action: z3.literal("refresh_index").describe("Request explicit indexing retry for every document.") })
|
|
1032
1075
|
]);
|
|
1033
1076
|
function required(method, name) {
|
|
1034
1077
|
if (!method)
|
|
@@ -1089,7 +1132,7 @@ function registerBatchAndWorkspaceCapabilities(server, client2, wrap) {
|
|
|
1089
1132
|
}, wrap("batch_documents", batch, toolOutputSchemas.batch_documents));
|
|
1090
1133
|
server.registerTool("get_workspace_item", {
|
|
1091
1134
|
description: "Read one visible folder, category, or tag by UUID. Folder uses its direct API getter; category and tag lookup uses the complete permission-filtered lists. An absent or out-of-scope ID is reported as not found. Use list_workspace_structure to discover IDs first.",
|
|
1092
|
-
inputSchema:
|
|
1135
|
+
inputSchema: withClientRoutingSchema(z3.strictObject({ kind: z3.enum(["folder", "category", "tag"]).describe("The workspace resource type to read by ID."), id: uuid })),
|
|
1093
1136
|
outputSchema: toolOutputSchemas.get_workspace_item,
|
|
1094
1137
|
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false }
|
|
1095
1138
|
}, wrap("get_workspace_item", async ({ kind, id }) => {
|
|
@@ -1104,10 +1147,10 @@ function registerBatchAndWorkspaceCapabilities(server, client2, wrap) {
|
|
|
1104
1147
|
}
|
|
1105
1148
|
|
|
1106
1149
|
// ../mcp-server/src/compact.ts
|
|
1107
|
-
var uuid2 =
|
|
1108
|
-
var text =
|
|
1109
|
-
var title =
|
|
1110
|
-
var content =
|
|
1150
|
+
var uuid2 = z4.string().uuid().describe("UUID returned by the corresponding list or read operation.");
|
|
1151
|
+
var text = z4.string().min(1).describe("Non-empty human-readable name or title.");
|
|
1152
|
+
var title = z4.string().min(1).max(500).describe("Document title, from 1 to 500 characters.");
|
|
1153
|
+
var content = z4.string().describe("Markdown document content; an empty string clears the content on update.");
|
|
1111
1154
|
var read = { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false };
|
|
1112
1155
|
var write = { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false };
|
|
1113
1156
|
var destructive = { ...write, destructiveHint: true };
|
|
@@ -1120,14 +1163,14 @@ function registerCompactCapabilities(server, client2, wrap) {
|
|
|
1120
1163
|
function register(name, description, inputSchema, annotations, handler) {
|
|
1121
1164
|
server.registerTool(name, { description, inputSchema: withClientRoutingSchema(inputSchema), outputSchema: toolOutputSchemas[name], annotations }, wrap(name, handler, toolOutputSchemas[name]));
|
|
1122
1165
|
}
|
|
1123
|
-
register("find_documents", "Find readable documents in the active scope. Use mode=list for paginated browsing by folder or tag UUID; use mode=search for hybrid text and semantic retrieval with tag names.",
|
|
1124
|
-
|
|
1125
|
-
|
|
1166
|
+
register("find_documents", "Find readable documents in the active scope. Use mode=list for paginated browsing by folder or tag UUID; use mode=search for hybrid text and semantic retrieval with tag names.", z4.discriminatedUnion("mode", [
|
|
1167
|
+
z4.strictObject({ mode: z4.literal("list").describe("Select the list operation explicitly."), folderId: uuid2.optional(), tag: uuid2.optional(), page: z4.number().int().min(1).optional().describe("One-based page number; defaults to the API first page."), limit: z4.number().int().min(1).max(1000).optional().describe("Maximum documents per page, up to 1000.") }),
|
|
1168
|
+
z4.strictObject({ mode: z4.literal("search").describe("Select the search operation explicitly."), query: text.describe("Text to search in the original language."), folder: z4.string().optional().describe("Optional folder UUID filter for search."), tags: z4.array(z4.string()).optional().describe("Optional tag names; all supplied names must match."), limit: z4.number().int().min(1).max(100).optional().describe("Maximum results to return, up to 100.") })
|
|
1126
1169
|
]), read, async (input) => input.mode === "list" ? { operation: "list", result: await client2.listDocuments(input) } : { operation: "search", result: await client2.search(input) });
|
|
1127
|
-
register("read_document", "Read one document by UUID. Choose detail for content and metadata, markdown for portable export, or versions for saved revisions and snapshots. All views are read-only.",
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1170
|
+
register("read_document", "Read one document by UUID. Choose detail for content and metadata, markdown for portable export, or versions for saved revisions and snapshots. All views are read-only.", z4.discriminatedUnion("view", [
|
|
1171
|
+
z4.strictObject({ view: z4.literal("detail").describe("Select the detail operation explicitly."), id: uuid2 }),
|
|
1172
|
+
z4.strictObject({ view: z4.literal("markdown").describe("Select the markdown operation explicitly."), id: uuid2 }),
|
|
1173
|
+
z4.strictObject({ view: z4.literal("versions").describe("Select the versions operation explicitly."), id: uuid2, onlySnapshots: z4.boolean().optional().describe("When true, return only named snapshots.") })
|
|
1131
1174
|
]), read, async (input) => {
|
|
1132
1175
|
if (input.view === "detail")
|
|
1133
1176
|
return { operation: "detail", result: await client2.getDocument(input.id) };
|
|
@@ -1135,9 +1178,9 @@ function registerCompactCapabilities(server, client2, wrap) {
|
|
|
1135
1178
|
return { operation: "markdown", result: await client2.exportDocument(input.id) };
|
|
1136
1179
|
return { operation: "versions", result: await client2.getVersionHistory(input.id, input.onlySnapshots) };
|
|
1137
1180
|
});
|
|
1138
|
-
register("save_document", "Create or update one document. Use action=create for a new document or action=update for an existing one; batch_documents handles the same placement change across multiple existing documents. Creation requires write access; content edits require edit access, and placement changes may require write access. Content or placement changes queue normal indexing.",
|
|
1139
|
-
|
|
1140
|
-
|
|
1181
|
+
register("save_document", "Create or update one document. Use action=create for a new document or action=update for an existing one; batch_documents handles the same placement change across multiple existing documents. Creation requires write access; content edits require edit access, and placement changes may require write access. Content or placement changes queue normal indexing.", z4.discriminatedUnion("action", [
|
|
1182
|
+
z4.strictObject({ action: z4.literal("create").describe("Select the create operation explicitly."), title: title.optional(), content: content.optional(), folderId: uuid2.optional(), categoryId: uuid2.nullable().optional().describe("Optional category UUID; null clears the explicit category.") }),
|
|
1183
|
+
z4.strictObject({ action: z4.literal("update").describe("Select the update operation explicitly."), id: uuid2, title: title.optional(), content: content.optional(), folderId: uuid2.nullable().optional().describe("Optional folder UUID; null clears the placement on update."), categoryId: uuid2.nullable().optional().describe("Optional category UUID; null clears the explicit category.") }).refine((value) => value.title !== undefined || value.content !== undefined || value.folderId !== undefined || value.categoryId !== undefined)
|
|
1141
1184
|
]), destructive, async (input) => {
|
|
1142
1185
|
if (input.action === "create") {
|
|
1143
1186
|
const { action: _action2, ...data2 } = input;
|
|
@@ -1146,24 +1189,27 @@ function registerCompactCapabilities(server, client2, wrap) {
|
|
|
1146
1189
|
const { action: _action, id, ...data } = input;
|
|
1147
1190
|
return { operation: "update", result: await client2.updateDocument(id, data) };
|
|
1148
1191
|
});
|
|
1149
|
-
register("delete_document", "Move one document to trash without purging content or versions. Use batch_documents(action=trash) for multiple explicit IDs. Requires write access and an explicit delete request; permanently_delete_document is a separate irreversible action.",
|
|
1192
|
+
register("delete_document", "Move one document to trash without purging content or versions. Use batch_documents(action=trash) for multiple explicit IDs. Requires write access and an explicit delete request; permanently_delete_document is a separate irreversible action.", z4.strictObject({ id: uuid2 }), destructive, async ({ id }) => {
|
|
1150
1193
|
await required2(client2.deleteDocument, "delete_document")(id);
|
|
1151
1194
|
return { id, deleted: true };
|
|
1152
1195
|
});
|
|
1153
|
-
register("list_workspace_structure", "
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1196
|
+
register("list_workspace_structure", "Discover permitted spaces with kind=workspaces, including empty spaces; use returned workspaceId for scoped operations. List folders, categories, or tags; set kind=folders for root folders or children of parentId. Unselected reads cover all granted scopes when supported by the host.", z4.discriminatedUnion("kind", [
|
|
1197
|
+
z4.strictObject({ kind: z4.literal("workspaces").describe("Discover every workspace granted to this connection, including empty ones.") }),
|
|
1198
|
+
z4.strictObject({ kind: z4.literal("folders").describe("Select the folders operation explicitly."), parentId: uuid2.optional() }),
|
|
1199
|
+
z4.strictObject({ kind: z4.literal("categories").describe("Select the categories operation explicitly.") }),
|
|
1200
|
+
z4.strictObject({ kind: z4.literal("tags").describe("Select the tags operation explicitly.") })
|
|
1157
1201
|
]), read, async (input) => {
|
|
1202
|
+
if (input.kind === "workspaces")
|
|
1203
|
+
throw new Error("Workspace routing is not configured");
|
|
1158
1204
|
if (input.kind === "folders")
|
|
1159
1205
|
return { operation: "folders", result: await client2.listFolders({ parentId: input.parentId }) };
|
|
1160
1206
|
if (input.kind === "categories")
|
|
1161
1207
|
return { operation: "categories", result: await client2.listCategories() };
|
|
1162
1208
|
return { operation: "tags", result: await client2.listTags() };
|
|
1163
1209
|
});
|
|
1164
|
-
register("save_folder", "Create or update a folder. action=update can rename or move an existing folder; the API enforces category boundaries and queues affected documents for reindexing.",
|
|
1165
|
-
|
|
1166
|
-
|
|
1210
|
+
register("save_folder", "Create or update a folder. action=update can rename or move an existing folder; the API enforces category boundaries and queues affected documents for reindexing.", z4.discriminatedUnion("action", [
|
|
1211
|
+
z4.strictObject({ action: z4.literal("create").describe("Select the create operation explicitly."), name: text.max(255), parentId: uuid2.nullable().optional().describe("Optional parent folder UUID; null selects the root."), categoryId: uuid2.nullable().optional().describe("Optional category UUID; null clears the explicit category.") }),
|
|
1212
|
+
z4.strictObject({ action: z4.literal("update").describe("Select the update operation explicitly."), id: uuid2, name: text.max(255).optional(), parentId: uuid2.nullable().optional().describe("Optional parent folder UUID; null selects the root."), categoryId: uuid2.nullable().optional().describe("Optional category UUID; null clears the explicit category."), order: z4.number().int().nonnegative().optional().describe("New non-negative display order.") }).refine((value) => value.name !== undefined || value.parentId !== undefined || value.categoryId !== undefined || value.order !== undefined)
|
|
1167
1213
|
]), destructive, async (input) => {
|
|
1168
1214
|
if (input.action === "create") {
|
|
1169
1215
|
const { action: _action2, ...data2 } = input;
|
|
@@ -1172,37 +1218,37 @@ function registerCompactCapabilities(server, client2, wrap) {
|
|
|
1172
1218
|
const { action: _action, id, ...data } = input;
|
|
1173
1219
|
return { operation: "update", result: await required2(client2.updateFolder, "update_folder")(id, data) };
|
|
1174
1220
|
});
|
|
1175
|
-
register("delete_folder", "Delete a folder while preserving its documents; child folders and documents are detached under the API rules. Requires write access.",
|
|
1221
|
+
register("delete_folder", "Delete a folder while preserving its documents; child folders and documents are detached under the API rules. Requires write access.", z4.strictObject({ id: uuid2 }), destructive, async ({ id }) => {
|
|
1176
1222
|
await required2(client2.deleteFolder, "delete_folder")(id);
|
|
1177
1223
|
return { id, deleted: true };
|
|
1178
1224
|
});
|
|
1179
|
-
register("save_category", "Create or update a workspace category. Full workspace write access is required; category-scoped credentials cannot manage categories.",
|
|
1180
|
-
|
|
1181
|
-
|
|
1225
|
+
register("save_category", "Create or update a workspace category. Full workspace write access is required; category-scoped credentials cannot manage categories.", z4.discriminatedUnion("action", [
|
|
1226
|
+
z4.strictObject({ action: z4.literal("create").describe("Select the create operation explicitly."), name: text.max(255) }),
|
|
1227
|
+
z4.strictObject({ action: z4.literal("update").describe("Select the update operation explicitly."), id: uuid2, name: text.max(255).optional(), order: z4.number().int().nonnegative().optional().describe("New non-negative display order.") }).refine((value) => value.name !== undefined || value.order !== undefined)
|
|
1182
1228
|
]), destructive, async (input) => {
|
|
1183
1229
|
if (input.action === "create")
|
|
1184
1230
|
return { operation: "create", result: await client2.createCategory({ name: input.name }) };
|
|
1185
1231
|
const { action: _action, id, ...data } = input;
|
|
1186
1232
|
return { operation: "update", result: await required2(client2.updateCategory, "update_category")(id, data) };
|
|
1187
1233
|
});
|
|
1188
|
-
register("delete_category", "Delete a workspace category and detach its documents without deleting them. Requires full workspace write access; category-scoped credentials are denied.",
|
|
1234
|
+
register("delete_category", "Delete a workspace category and detach its documents without deleting them. Requires full workspace write access; category-scoped credentials are denied.", z4.strictObject({ id: uuid2 }), destructive, async ({ id }) => {
|
|
1189
1235
|
await required2(client2.deleteCategory, "delete_category")(id);
|
|
1190
1236
|
return { id, deleted: true };
|
|
1191
1237
|
});
|
|
1192
|
-
register("save_tag", "Create or update a workspace tag. Full workspace write access is required; renaming or recoloring a tag causes affected documents to be reindexed.",
|
|
1193
|
-
|
|
1194
|
-
|
|
1238
|
+
register("save_tag", "Create or update a workspace tag. Full workspace write access is required; renaming or recoloring a tag causes affected documents to be reindexed.", z4.discriminatedUnion("action", [
|
|
1239
|
+
z4.strictObject({ action: z4.literal("create").describe("Select the create operation explicitly."), name: text.max(100), color: z4.string().max(20).optional().describe("Optional tag color, at most 20 characters.") }),
|
|
1240
|
+
z4.strictObject({ action: z4.literal("update").describe("Select the update operation explicitly."), id: uuid2, name: text.max(100).optional(), color: z4.string().max(20).optional().describe("Optional tag color, at most 20 characters.") }).refine((value) => value.name !== undefined || value.color !== undefined)
|
|
1195
1241
|
]), destructive, async (input) => {
|
|
1196
1242
|
if (input.action === "create")
|
|
1197
1243
|
return { operation: "create", result: await required2(client2.createTag, "create_tag")({ name: input.name, color: input.color }) };
|
|
1198
1244
|
const { action: _action, id, ...data } = input;
|
|
1199
1245
|
return { operation: "update", result: await required2(client2.updateTag, "update_tag")(id, data) };
|
|
1200
1246
|
});
|
|
1201
|
-
register("delete_tag", "Delete a workspace tag and remove its document assignments. Full workspace write access is required; documents themselves remain.",
|
|
1247
|
+
register("delete_tag", "Delete a workspace tag and remove its document assignments. Full workspace write access is required; documents themselves remain.", z4.strictObject({ id: uuid2 }), destructive, async ({ id }) => {
|
|
1202
1248
|
await required2(client2.deleteTag, "delete_tag")(id);
|
|
1203
1249
|
return { id, deleted: true };
|
|
1204
1250
|
});
|
|
1205
|
-
register("set_document_tag", "Add or remove an existing tag assignment on one document. Use batch_documents for the same tag action across multiple explicit IDs. Requires edit access to each document; action=remove preserves the tag itself.",
|
|
1251
|
+
register("set_document_tag", "Add or remove an existing tag assignment on one document. Use batch_documents for the same tag action across multiple explicit IDs. Requires edit access to each document; action=remove preserves the tag itself.", z4.strictObject({ action: z4.enum(["add", "remove"]).describe("Add or remove exactly one tag assignment."), documentId: uuid2, tagId: uuid2 }), destructive, async ({ action, documentId, tagId }) => {
|
|
1206
1252
|
if (action === "add") {
|
|
1207
1253
|
await required2(client2.addTagToDocument, "add_tag_to_document")(documentId, tagId);
|
|
1208
1254
|
return { operation: "add", result: { documentId, tagId, assigned: true } };
|
|
@@ -1210,17 +1256,17 @@ function registerCompactCapabilities(server, client2, wrap) {
|
|
|
1210
1256
|
await required2(client2.removeTagFromDocument, "remove_tag_from_document")(documentId, tagId);
|
|
1211
1257
|
return { operation: "remove", result: { documentId, tagId, removed: true } };
|
|
1212
1258
|
});
|
|
1213
|
-
register("create_snapshot", "Save a named snapshot of an existing document before a planned change. The snapshot can later be restored with restore_document_version.",
|
|
1214
|
-
register("restore_document_version", "Restore content from a version or snapshot listed by read_document(view=versions). This changes current content and queues indexing; it does not restore a trashed document.",
|
|
1215
|
-
register("explore_graph", "Explore graph relations from readable seed documents. mode=neighbors traverses one document without a query; mode=search ranks relations from one or more seed IDs with optional query text.",
|
|
1216
|
-
|
|
1217
|
-
|
|
1259
|
+
register("create_snapshot", "Save a named snapshot of an existing document before a planned change. The snapshot can later be restored with restore_document_version.", z4.strictObject({ documentId: uuid2, label: text.max(200).describe("Snapshot label, from 1 to 200 characters."), description: z4.string().max(1000).optional().describe("Optional snapshot note, at most 1000 characters.") }), write, async ({ documentId, label, description }) => client2.createSnapshot(documentId, { label, description }));
|
|
1260
|
+
register("restore_document_version", "Restore content from a version or snapshot listed by read_document(view=versions). This changes current content and queues indexing; it does not restore a trashed document.", z4.strictObject({ documentId: uuid2, versionId: uuid2 }), destructive, async ({ documentId, versionId }) => required2(client2.restoreDocumentVersion, "restore_document_version")(documentId, versionId));
|
|
1261
|
+
register("explore_graph", "Explore graph relations from readable seed documents. mode=neighbors traverses one document without a query; mode=search ranks relations from one or more seed IDs with optional query text.", z4.discriminatedUnion("mode", [
|
|
1262
|
+
z4.strictObject({ mode: z4.literal("neighbors").describe("Select the neighbors operation explicitly."), documentId: uuid2, limit: z4.number().int().min(1).max(100).optional().describe("Maximum results to return, up to 100.") }),
|
|
1263
|
+
z4.strictObject({ mode: z4.literal("search").describe("Select the search operation explicitly."), docIds: z4.array(uuid2).min(1).max(50).describe("One to 50 authorized seed document UUIDs."), query: z4.string().max(2000).optional().describe("Optional graph relevance query, at most 2000 characters."), limit: z4.number().int().min(1).max(100).optional().describe("Maximum results to return, up to 100.") })
|
|
1218
1264
|
]), read, async (input) => input.mode === "neighbors" ? { operation: "neighbors", result: await client2.getRelatedDocuments(input.documentId, input.limit) } : { operation: "search", result: await client2.searchGraph(input) });
|
|
1219
|
-
register("get_document_index_status", "Read current indexing and pipeline status for one document without starting work. Use refresh_document_index only when an explicit retry is intended.",
|
|
1220
|
-
register("refresh_document_index", "Queue an explicit asynchronous reindex for one document; use batch_documents(action=refresh_index) for multiple explicit IDs. Routine content and placement changes already schedule indexing; check get_document_index_status first.",
|
|
1221
|
-
register("list_trash", "List soft-deleted documents visible to the active workspace or category scope. Requires read access and does not restore or purge anything.",
|
|
1222
|
-
register("restore_trashed_document", "Return one document from trash to the active library; use batch_documents(action=restore) for multiple explicit IDs. This restores the document itself, unlike restore_document_version which changes content.",
|
|
1223
|
-
register("permanently_delete_document", "Irreversibly purge a document already in trash, including its version history. Use only on an explicit user request after checking list_trash.",
|
|
1265
|
+
register("get_document_index_status", "Read current indexing and pipeline status for one document without starting work. Use refresh_document_index only when an explicit retry is intended.", z4.strictObject({ documentId: uuid2 }), read, async ({ documentId }) => client2.getDocumentIndexStatus(documentId));
|
|
1266
|
+
register("refresh_document_index", "Queue an explicit asynchronous reindex for one document; use batch_documents(action=refresh_index) for multiple explicit IDs. Routine content and placement changes already schedule indexing; check get_document_index_status first.", z4.strictObject({ documentId: uuid2 }), write, async ({ documentId }) => client2.refreshDocumentIndex(documentId));
|
|
1267
|
+
register("list_trash", "List soft-deleted documents visible to the active workspace or category scope. Requires read access and does not restore or purge anything.", z4.strictObject({}), read, async () => required2(client2.listTrash, "list_trash")());
|
|
1268
|
+
register("restore_trashed_document", "Return one document from trash to the active library; use batch_documents(action=restore) for multiple explicit IDs. This restores the document itself, unlike restore_document_version which changes content.", z4.strictObject({ id: uuid2 }), write, async ({ id }) => required2(client2.restoreTrashedDocument, "restore_trashed_document")(id));
|
|
1269
|
+
register("permanently_delete_document", "Irreversibly purge a document already in trash, including its version history. Use only on an explicit user request after checking list_trash.", z4.strictObject({ id: uuid2 }), destructive, async ({ id }) => {
|
|
1224
1270
|
await required2(client2.permanentlyDeleteDocument, "permanently_delete_document")(id);
|
|
1225
1271
|
return { id, deleted: true };
|
|
1226
1272
|
});
|
|
@@ -1228,13 +1274,13 @@ function registerCompactCapabilities(server, client2, wrap) {
|
|
|
1228
1274
|
}
|
|
1229
1275
|
|
|
1230
1276
|
// ../mcp-server/src/prompts-resources.ts
|
|
1231
|
-
import { z as
|
|
1277
|
+
import { z as z5 } from "zod";
|
|
1232
1278
|
function registerPromptsAndResources(server, client2) {
|
|
1233
1279
|
server.registerPrompt("organize_workspace", {
|
|
1234
1280
|
description: "Plan safe document organization using DocsMint categories and folders.",
|
|
1235
|
-
argsSchema:
|
|
1236
|
-
objective:
|
|
1237
|
-
language:
|
|
1281
|
+
argsSchema: z5.object({
|
|
1282
|
+
objective: z5.string(),
|
|
1283
|
+
language: z5.string().optional()
|
|
1238
1284
|
})
|
|
1239
1285
|
}, ({ objective, language }) => ({
|
|
1240
1286
|
messages: [
|
|
@@ -1249,9 +1295,9 @@ function registerPromptsAndResources(server, client2) {
|
|
|
1249
1295
|
}));
|
|
1250
1296
|
server.registerPrompt("research_workspace", {
|
|
1251
1297
|
description: "Research a question with hybrid search and GraphRAG while citing DocsMint document IDs.",
|
|
1252
|
-
argsSchema:
|
|
1253
|
-
question:
|
|
1254
|
-
language:
|
|
1298
|
+
argsSchema: z5.object({
|
|
1299
|
+
question: z5.string(),
|
|
1300
|
+
language: z5.string().optional()
|
|
1255
1301
|
})
|
|
1256
1302
|
}, ({ question, language }) => ({
|
|
1257
1303
|
messages: [
|
|
@@ -1305,10 +1351,24 @@ Use find_documents(mode=search) for normal retrieval. Use explore_graph only wit
|
|
|
1305
1351
|
}
|
|
1306
1352
|
|
|
1307
1353
|
// ../mcp-server/src/server.ts
|
|
1308
|
-
function wrapHandler(name, handler, outputSchema) {
|
|
1354
|
+
function wrapHandler(name, handler, outputSchema, workspaceRouting) {
|
|
1309
1355
|
return async (args) => {
|
|
1310
1356
|
try {
|
|
1311
|
-
const
|
|
1357
|
+
const { workspaceId, ...data } = args;
|
|
1358
|
+
if (workspaceId !== undefined) {
|
|
1359
|
+
if (!workspaceRouting)
|
|
1360
|
+
throw new Error("Workspace routing is not configured");
|
|
1361
|
+
await workspaceRouting.assertSelection(workspaceId);
|
|
1362
|
+
}
|
|
1363
|
+
let output;
|
|
1364
|
+
if (name === "list_workspace_structure" && data.kind === "workspaces") {
|
|
1365
|
+
if (!workspaceRouting)
|
|
1366
|
+
throw new Error("Workspace routing is not configured");
|
|
1367
|
+
const workspaces = await workspaceRouting.listWorkspaces();
|
|
1368
|
+
output = { operation: "workspaces", result: workspaceId ? workspaces.filter((item) => item.id === workspaceId) : workspaces };
|
|
1369
|
+
} else {
|
|
1370
|
+
output = await handler(data);
|
|
1371
|
+
}
|
|
1312
1372
|
const parsedOutput = outputSchema ? await outputSchema.safeParseAsync(output) : undefined;
|
|
1313
1373
|
if (parsedOutput && !parsedOutput.success) {
|
|
1314
1374
|
throw new Error(`Tool '${name}' returned a result outside its published output schema`);
|
|
@@ -1342,14 +1402,15 @@ function wrapHandler(name, handler, outputSchema) {
|
|
|
1342
1402
|
}
|
|
1343
1403
|
};
|
|
1344
1404
|
}
|
|
1345
|
-
function registerDocsmintMcpCapabilities(server, client2) {
|
|
1346
|
-
|
|
1405
|
+
function registerDocsmintMcpCapabilities(server, client2, workspaceRouting) {
|
|
1406
|
+
const wrap = (name, handler, outputSchema) => wrapHandler(name, handler, outputSchema, workspaceRouting);
|
|
1407
|
+
registerCompactCapabilities(server, client2, wrap);
|
|
1347
1408
|
registerPromptsAndResources(server, client2);
|
|
1348
1409
|
}
|
|
1349
1410
|
function createDocsmintMcpServer(options = {}) {
|
|
1350
|
-
const server = new McpServer({ name: "docsmint", version: "
|
|
1411
|
+
const server = new McpServer({ name: "docsmint", version: "2.0.3" });
|
|
1351
1412
|
const client2 = options.docsClient ? createMcpDocsClient(options.docsClient, options.requestContext) : options.client ?? createMcpDocsClient(createDefaultDocsClient(), options.requestContext);
|
|
1352
|
-
registerDocsmintMcpCapabilities(server, client2);
|
|
1413
|
+
registerDocsmintMcpCapabilities(server, client2, options.workspaceRouting);
|
|
1353
1414
|
return server;
|
|
1354
1415
|
}
|
|
1355
1416
|
|
package/dist/mcp-server.d.ts
CHANGED
|
@@ -34,9 +34,23 @@ export interface HiaiDocsClient {
|
|
|
34
34
|
exportDocument(id: string): Promise<{ markdown: string; filename?: string }>;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
export interface McpWorkspaceDescriptor {
|
|
38
|
+
id: string;
|
|
39
|
+
name: string;
|
|
40
|
+
slug: string;
|
|
41
|
+
entireWorkspace: boolean;
|
|
42
|
+
categoryIds: string[];
|
|
43
|
+
}
|
|
44
|
+
export interface McpWorkspaceRouting {
|
|
45
|
+
listWorkspaces(): Promise<McpWorkspaceDescriptor[]>;
|
|
46
|
+
assertSelection(workspaceId: string): Promise<void>;
|
|
47
|
+
}
|
|
48
|
+
export declare function createMcpScopedResult(toolName: 'find_documents' | 'list_workspace_structure' | 'list_trash', input: unknown): unknown;
|
|
49
|
+
|
|
37
50
|
export interface CreateDocsmintMcpServerOptions {
|
|
38
51
|
docsClient?: DocsClient;
|
|
39
52
|
requestContext?: DocsRequestContext;
|
|
53
|
+
workspaceRouting?: McpWorkspaceRouting;
|
|
40
54
|
/** @deprecated Inject a legacy capability client only for compatibility. */
|
|
41
55
|
client?: HiaiDocsClient;
|
|
42
56
|
}
|
|
@@ -44,6 +58,7 @@ export interface CreateDocsmintMcpServerOptions {
|
|
|
44
58
|
export declare function registerDocsmintMcpCapabilities(
|
|
45
59
|
server: McpServer,
|
|
46
60
|
client: HiaiDocsClient,
|
|
61
|
+
workspaceRouting?: McpWorkspaceRouting,
|
|
47
62
|
): void;
|
|
48
63
|
|
|
49
64
|
export declare function createDocsmintMcpServer(
|