mcp-dataverse 0.1.5 → 0.1.7
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/CAPABILITIES.md +1049 -992
- package/README.md +92 -80
- package/config.example.json +0 -1
- package/dist/auth/auth-provider.factory.d.ts +2 -2
- package/dist/auth/auth-provider.factory.js +4 -4
- package/dist/auth/msal-auth-provider.d.ts +2 -2
- package/dist/auth/msal-auth-provider.d.ts.map +1 -1
- package/dist/auth/msal-auth-provider.js +9 -7
- package/dist/auth/msal-auth-provider.js.map +1 -1
- package/dist/auth/pac-auth-provider.d.ts +1 -1
- package/dist/auth/pac-auth-provider.d.ts.map +1 -1
- package/dist/auth/pac-auth-provider.js +39 -35
- package/dist/auth/pac-auth-provider.js.map +1 -1
- package/dist/config/config.loader.d.ts +1 -1
- package/dist/config/config.loader.js +25 -28
- package/dist/config/config.loader.js.map +1 -1
- package/dist/config/config.schema.d.ts +1 -4
- package/dist/config/config.schema.d.ts.map +1 -1
- package/dist/config/config.schema.js +11 -11
- package/dist/config/config.schema.js.map +1 -1
- package/dist/dataverse/dataverse-client-advanced.d.ts +1 -1
- package/dist/dataverse/dataverse-client-advanced.d.ts.map +1 -1
- package/dist/dataverse/dataverse-client-advanced.js +70 -39
- package/dist/dataverse/dataverse-client-advanced.js.map +1 -1
- package/dist/dataverse/dataverse-client.actions.d.ts +11 -0
- package/dist/dataverse/dataverse-client.actions.d.ts.map +1 -0
- package/dist/dataverse/dataverse-client.actions.js +25 -0
- package/dist/dataverse/dataverse-client.actions.js.map +1 -0
- package/dist/dataverse/dataverse-client.batch.d.ts +2 -2
- package/dist/dataverse/dataverse-client.batch.d.ts.map +1 -1
- package/dist/dataverse/dataverse-client.batch.js +12 -12
- package/dist/dataverse/dataverse-client.batch.js.map +1 -1
- package/dist/dataverse/dataverse-client.d.ts +5 -8
- package/dist/dataverse/dataverse-client.d.ts.map +1 -1
- package/dist/dataverse/dataverse-client.js +81 -81
- package/dist/dataverse/dataverse-client.js.map +1 -1
- package/dist/dataverse/dataverse-client.metadata.d.ts +3 -3
- package/dist/dataverse/dataverse-client.metadata.d.ts.map +1 -1
- package/dist/dataverse/dataverse-client.metadata.js +45 -45
- package/dist/dataverse/dataverse-client.metadata.js.map +1 -1
- package/dist/dataverse/dataverse-client.utils.d.ts.map +1 -1
- package/dist/dataverse/dataverse-client.utils.js +5 -5
- package/dist/dataverse/dataverse-client.utils.js.map +1 -1
- package/dist/dataverse/http-client.d.ts +1 -1
- package/dist/dataverse/http-client.d.ts.map +1 -1
- package/dist/dataverse/http-client.js +25 -18
- package/dist/dataverse/http-client.js.map +1 -1
- package/dist/dataverse/types.d.ts +5 -5
- package/dist/server.js +57 -57
- package/dist/server.js.map +1 -1
- package/dist/setup-auth.js +8 -8
- package/dist/setup-auth.js.map +1 -1
- package/dist/tools/actions.tools.d.ts +2 -2
- package/dist/tools/actions.tools.d.ts.map +1 -1
- package/dist/tools/actions.tools.js +108 -65
- package/dist/tools/actions.tools.js.map +1 -1
- package/dist/tools/annotations.tools.d.ts +2 -2
- package/dist/tools/annotations.tools.d.ts.map +1 -1
- package/dist/tools/annotations.tools.js +79 -70
- package/dist/tools/annotations.tools.js.map +1 -1
- package/dist/tools/audit.tools.d.ts +2 -2
- package/dist/tools/audit.tools.d.ts.map +1 -1
- package/dist/tools/audit.tools.js +51 -48
- package/dist/tools/audit.tools.js.map +1 -1
- package/dist/tools/auth.tools.d.ts +2 -2
- package/dist/tools/auth.tools.d.ts.map +1 -1
- package/dist/tools/auth.tools.js +9 -7
- package/dist/tools/auth.tools.js.map +1 -1
- package/dist/tools/batch.tools.d.ts +2 -2
- package/dist/tools/batch.tools.d.ts.map +1 -1
- package/dist/tools/batch.tools.js +39 -26
- package/dist/tools/batch.tools.js.map +1 -1
- package/dist/tools/crud.tools.d.ts +2 -2
- package/dist/tools/crud.tools.d.ts.map +1 -1
- package/dist/tools/crud.tools.js +140 -83
- package/dist/tools/crud.tools.js.map +1 -1
- package/dist/tools/customization.tools.d.ts +2 -2
- package/dist/tools/customization.tools.d.ts.map +1 -1
- package/dist/tools/customization.tools.js +72 -62
- package/dist/tools/customization.tools.js.map +1 -1
- package/dist/tools/environment.tools.d.ts +2 -2
- package/dist/tools/environment.tools.d.ts.map +1 -1
- package/dist/tools/environment.tools.js +62 -55
- package/dist/tools/environment.tools.js.map +1 -1
- package/dist/tools/file.tools.d.ts +2 -2
- package/dist/tools/file.tools.d.ts.map +1 -1
- package/dist/tools/file.tools.js +63 -44
- package/dist/tools/file.tools.js.map +1 -1
- package/dist/tools/impersonate.tools.d.ts +3 -3
- package/dist/tools/impersonate.tools.d.ts.map +1 -1
- package/dist/tools/impersonate.tools.js +22 -20
- package/dist/tools/impersonate.tools.js.map +1 -1
- package/dist/tools/metadata.tools.d.ts +2 -2
- package/dist/tools/metadata.tools.d.ts.map +1 -1
- package/dist/tools/metadata.tools.js +110 -75
- package/dist/tools/metadata.tools.js.map +1 -1
- package/dist/tools/org.tools.d.ts +2 -2
- package/dist/tools/org.tools.d.ts.map +1 -1
- package/dist/tools/org.tools.js +21 -15
- package/dist/tools/org.tools.js.map +1 -1
- package/dist/tools/quality.tools.d.ts +2 -2
- package/dist/tools/quality.tools.d.ts.map +1 -1
- package/dist/tools/quality.tools.js +19 -17
- package/dist/tools/quality.tools.js.map +1 -1
- package/dist/tools/query.tools.d.ts +2 -2
- package/dist/tools/query.tools.d.ts.map +1 -1
- package/dist/tools/query.tools.js +81 -58
- package/dist/tools/query.tools.js.map +1 -1
- package/dist/tools/relations.tools.d.ts +2 -2
- package/dist/tools/relations.tools.d.ts.map +1 -1
- package/dist/tools/relations.tools.js +62 -26
- package/dist/tools/relations.tools.js.map +1 -1
- package/dist/tools/search.tools.d.ts +2 -2
- package/dist/tools/search.tools.d.ts.map +1 -1
- package/dist/tools/search.tools.js +45 -45
- package/dist/tools/search.tools.js.map +1 -1
- package/dist/tools/solution.tools.d.ts +2 -2
- package/dist/tools/solution.tools.d.ts.map +1 -1
- package/dist/tools/solution.tools.js +89 -55
- package/dist/tools/solution.tools.js.map +1 -1
- package/dist/tools/teams.tools.d.ts +2 -2
- package/dist/tools/teams.tools.d.ts.map +1 -1
- package/dist/tools/teams.tools.js +33 -29
- package/dist/tools/teams.tools.js.map +1 -1
- package/dist/tools/trace.tools.d.ts +2 -2
- package/dist/tools/trace.tools.d.ts.map +1 -1
- package/dist/tools/trace.tools.js +111 -101
- package/dist/tools/trace.tools.js.map +1 -1
- package/dist/tools/tracking.tools.d.ts +2 -2
- package/dist/tools/tracking.tools.d.ts.map +1 -1
- package/dist/tools/tracking.tools.js +16 -14
- package/dist/tools/tracking.tools.js.map +1 -1
- package/dist/tools/users.tools.d.ts +2 -2
- package/dist/tools/users.tools.d.ts.map +1 -1
- package/dist/tools/users.tools.js +62 -57
- package/dist/tools/users.tools.js.map +1 -1
- package/dist/tools/validation.utils.d.ts +1 -1
- package/dist/tools/validation.utils.d.ts.map +1 -1
- package/dist/tools/validation.utils.js +9 -3
- package/dist/tools/validation.utils.js.map +1 -1
- package/dist/tools/views.tools.d.ts +2 -2
- package/dist/tools/views.tools.d.ts.map +1 -1
- package/dist/tools/views.tools.js +32 -24
- package/dist/tools/views.tools.js.map +1 -1
- package/package.json +81 -81
- package/server.json +59 -4
|
@@ -1,100 +1,123 @@
|
|
|
1
|
-
import { z } from
|
|
2
|
-
import { safeEntitySetName } from
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { safeEntitySetName } from "./validation.utils.js";
|
|
3
3
|
export const actionTools = [
|
|
4
4
|
{
|
|
5
|
-
name:
|
|
6
|
-
description:
|
|
5
|
+
name: "dataverse_execute_action",
|
|
6
|
+
description: "Executes a global (unbound) Dataverse action that is not tied to a specific record — for example WinOpportunity, SendEmail, or custom process actions. Use dataverse_execute_bound_action when the action must operate on a particular record. Actions differ from functions in that they are state-changing operations; for read-only operations use dataverse_execute_function.",
|
|
7
7
|
inputSchema: {
|
|
8
|
-
type:
|
|
8
|
+
type: "object",
|
|
9
9
|
properties: {
|
|
10
|
-
actionName: {
|
|
11
|
-
|
|
10
|
+
actionName: {
|
|
11
|
+
type: "string",
|
|
12
|
+
description: 'Action logical name (e.g., "WinOpportunity")',
|
|
13
|
+
},
|
|
14
|
+
parameters: { type: "object", description: "Action parameters" },
|
|
12
15
|
},
|
|
13
|
-
required: [
|
|
16
|
+
required: ["actionName"],
|
|
14
17
|
},
|
|
15
18
|
},
|
|
16
19
|
{
|
|
17
|
-
name:
|
|
18
|
-
description:
|
|
20
|
+
name: "dataverse_execute_function",
|
|
21
|
+
description: "Executes a global (unbound) Dataverse OData function that is read-only and returns data without side effects — for example RetrieveTotalRecordCount or InitializeFrom. Use dataverse_execute_action for state-changing operations. Use dataverse_execute_bound_action when the function/action requires a specific record context.",
|
|
19
22
|
inputSchema: {
|
|
20
|
-
type:
|
|
23
|
+
type: "object",
|
|
21
24
|
properties: {
|
|
22
25
|
functionName: {
|
|
23
|
-
type:
|
|
26
|
+
type: "string",
|
|
24
27
|
description: 'Function name (e.g., "WhoAmI", "RetrieveTotalRecordCount")',
|
|
25
28
|
},
|
|
26
|
-
parameters: {
|
|
29
|
+
parameters: {
|
|
30
|
+
type: "object",
|
|
31
|
+
description: "Function parameters as string key-value pairs",
|
|
32
|
+
},
|
|
27
33
|
},
|
|
28
|
-
required: [
|
|
34
|
+
required: ["functionName"],
|
|
29
35
|
},
|
|
30
36
|
},
|
|
31
37
|
{
|
|
32
|
-
name:
|
|
33
|
-
description:
|
|
38
|
+
name: "dataverse_execute_bound_action",
|
|
39
|
+
description: "Executes a Dataverse action bound to a specific record instance, passing the entity set name and record GUID as context (e.g., QualifyLead on a lead, or a custom action scoped to an account). The actionName should not include the Microsoft.Dynamics.CRM namespace prefix. Use dataverse_execute_action for global unbound actions that do not require a record context.",
|
|
34
40
|
inputSchema: {
|
|
35
|
-
type:
|
|
41
|
+
type: "object",
|
|
36
42
|
properties: {
|
|
37
|
-
entitySetName: { type:
|
|
38
|
-
id: { type:
|
|
39
|
-
actionName: {
|
|
40
|
-
|
|
43
|
+
entitySetName: { type: "string" },
|
|
44
|
+
id: { type: "string", description: "Record GUID" },
|
|
45
|
+
actionName: {
|
|
46
|
+
type: "string",
|
|
47
|
+
description: "Action name (without Microsoft.Dynamics.CRM prefix)",
|
|
48
|
+
},
|
|
49
|
+
parameters: { type: "object", description: "Action parameters" },
|
|
41
50
|
},
|
|
42
|
-
required: [
|
|
51
|
+
required: ["entitySetName", "id", "actionName"],
|
|
43
52
|
},
|
|
44
53
|
},
|
|
45
54
|
{
|
|
46
|
-
name:
|
|
47
|
-
description:
|
|
55
|
+
name: "dataverse_retrieve_dependencies_for_delete",
|
|
56
|
+
description: "Checks what solution components would block deletion of a specific component. Provide the Dataverse component type code (1=Entity, 2=Attribute, 26=SavedQuery, 29=Workflow, 92=PluginAssembly) and the component GUID. Use before deleting shared Dataverse customization components.",
|
|
48
57
|
inputSchema: {
|
|
49
|
-
type:
|
|
58
|
+
type: "object",
|
|
50
59
|
properties: {
|
|
51
60
|
componentType: {
|
|
52
|
-
type:
|
|
53
|
-
description:
|
|
61
|
+
type: "number",
|
|
62
|
+
description: "Dataverse component type code (1=Entity, 2=Attribute, 29=Workflow, 92=PluginAssembly)",
|
|
54
63
|
},
|
|
55
|
-
objectId: { type:
|
|
64
|
+
objectId: { type: "string", description: "Component GUID" },
|
|
56
65
|
},
|
|
57
|
-
required: [
|
|
66
|
+
required: ["componentType", "objectId"],
|
|
58
67
|
},
|
|
59
68
|
},
|
|
60
69
|
{
|
|
61
|
-
name:
|
|
62
|
-
description:
|
|
70
|
+
name: "dataverse_execute_bound_function",
|
|
71
|
+
description: "Executes a Dataverse function bound to a specific record (e.g., CalculateRollupField, GetQuantityAvailable). Use for read-only computed operations on a single record. Unlike bound actions, bound functions do not modify data.",
|
|
63
72
|
inputSchema: {
|
|
64
|
-
type:
|
|
73
|
+
type: "object",
|
|
65
74
|
properties: {
|
|
66
|
-
entitySetName: {
|
|
67
|
-
|
|
68
|
-
|
|
75
|
+
entitySetName: {
|
|
76
|
+
type: "string",
|
|
77
|
+
description: 'OData entity set name of the table (e.g., "accounts")',
|
|
78
|
+
},
|
|
79
|
+
id: { type: "string", description: "GUID of the record" },
|
|
80
|
+
functionName: {
|
|
81
|
+
type: "string",
|
|
82
|
+
description: 'Name of the bound function (e.g., "CalculateRollupField")',
|
|
83
|
+
},
|
|
69
84
|
parameters: {
|
|
70
|
-
type:
|
|
71
|
-
description:
|
|
72
|
-
additionalProperties: { type:
|
|
85
|
+
type: "object",
|
|
86
|
+
description: "Function parameters as key-value pairs of strings",
|
|
87
|
+
additionalProperties: { type: "string" },
|
|
73
88
|
},
|
|
74
89
|
},
|
|
75
|
-
required: [
|
|
90
|
+
required: ["entitySetName", "id", "functionName"],
|
|
76
91
|
},
|
|
77
92
|
},
|
|
78
93
|
{
|
|
79
|
-
name:
|
|
80
|
-
description:
|
|
94
|
+
name: "dataverse_list_dependencies",
|
|
95
|
+
description: "Lists workflows, Power Automate flows, Business Rules, and custom actions that reference a given table. Use to detect hidden dependencies before modifying or removing a table. Returns component name, type, state (Active/Draft), trigger event (Create/Update/Delete), and count.",
|
|
81
96
|
inputSchema: {
|
|
82
|
-
type:
|
|
97
|
+
type: "object",
|
|
83
98
|
properties: {
|
|
84
99
|
tableName: {
|
|
85
|
-
type:
|
|
100
|
+
type: "string",
|
|
86
101
|
description: 'Logical name of the table to check (e.g., "account", "contact")',
|
|
87
102
|
},
|
|
88
103
|
componentType: {
|
|
89
|
-
type:
|
|
104
|
+
type: "array",
|
|
90
105
|
items: {
|
|
91
|
-
type:
|
|
92
|
-
enum: [
|
|
106
|
+
type: "string",
|
|
107
|
+
enum: [
|
|
108
|
+
"Workflow",
|
|
109
|
+
"Flow",
|
|
110
|
+
"BusinessRule",
|
|
111
|
+
"Action",
|
|
112
|
+
"BusinessProcessFlow",
|
|
113
|
+
"Plugin",
|
|
114
|
+
"CustomAPI",
|
|
115
|
+
],
|
|
93
116
|
},
|
|
94
|
-
description:
|
|
117
|
+
description: "Filter by component type. Default: all types.",
|
|
95
118
|
},
|
|
96
119
|
},
|
|
97
|
-
required: [
|
|
120
|
+
required: ["tableName"],
|
|
98
121
|
},
|
|
99
122
|
},
|
|
100
123
|
];
|
|
@@ -104,14 +127,14 @@ const ExecuteActionInput = z.object({
|
|
|
104
127
|
actionName: z
|
|
105
128
|
.string()
|
|
106
129
|
.min(1)
|
|
107
|
-
.regex(SAFE_API_NAME,
|
|
130
|
+
.regex(SAFE_API_NAME, "actionName must contain only letters, digits, underscores, or dots"),
|
|
108
131
|
parameters: z.record(z.unknown()).optional().default({}),
|
|
109
132
|
});
|
|
110
133
|
const ExecuteFunctionInput = z.object({
|
|
111
134
|
functionName: z
|
|
112
135
|
.string()
|
|
113
136
|
.min(1)
|
|
114
|
-
.regex(SAFE_API_NAME,
|
|
137
|
+
.regex(SAFE_API_NAME, "functionName must contain only letters, digits, underscores, or dots"),
|
|
115
138
|
parameters: z.record(z.string()).optional().default({}),
|
|
116
139
|
});
|
|
117
140
|
const ExecuteBoundActionInput = z.object({
|
|
@@ -120,14 +143,22 @@ const ExecuteBoundActionInput = z.object({
|
|
|
120
143
|
actionName: z
|
|
121
144
|
.string()
|
|
122
145
|
.min(1)
|
|
123
|
-
.regex(SAFE_API_NAME,
|
|
146
|
+
.regex(SAFE_API_NAME, "actionName must contain only letters, digits, underscores, or dots"),
|
|
124
147
|
parameters: z.record(z.unknown()).optional().default({}),
|
|
125
148
|
});
|
|
126
149
|
const RetrieveDependenciesForDeleteInput = z.object({
|
|
127
150
|
componentType: z.number().int().positive(),
|
|
128
151
|
objectId: z.string().uuid(),
|
|
129
152
|
});
|
|
130
|
-
const VALID_COMPONENT_TYPES = [
|
|
153
|
+
const VALID_COMPONENT_TYPES = [
|
|
154
|
+
"Workflow",
|
|
155
|
+
"Flow",
|
|
156
|
+
"BusinessRule",
|
|
157
|
+
"Action",
|
|
158
|
+
"BusinessProcessFlow",
|
|
159
|
+
"Plugin",
|
|
160
|
+
"CustomAPI",
|
|
161
|
+
];
|
|
131
162
|
const ListTableDependenciesInput = z.object({
|
|
132
163
|
tableName: z.string().min(1),
|
|
133
164
|
componentType: z.array(z.enum(VALID_COMPONENT_TYPES)).optional(),
|
|
@@ -138,40 +169,52 @@ const ExecuteBoundFunctionInput = z.object({
|
|
|
138
169
|
functionName: z
|
|
139
170
|
.string()
|
|
140
171
|
.min(1)
|
|
141
|
-
.regex(SAFE_API_NAME,
|
|
172
|
+
.regex(SAFE_API_NAME, "functionName must contain only letters, digits, underscores, or dots"),
|
|
142
173
|
parameters: z.record(z.string()).optional().default({}),
|
|
143
174
|
});
|
|
144
175
|
export async function handleActionTool(name, args, client) {
|
|
145
176
|
switch (name) {
|
|
146
|
-
case
|
|
177
|
+
case "dataverse_execute_action": {
|
|
147
178
|
const { actionName, parameters } = ExecuteActionInput.parse(args);
|
|
148
179
|
const result = await client.executeAction(actionName, parameters);
|
|
149
|
-
return {
|
|
180
|
+
return {
|
|
181
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
|
|
182
|
+
};
|
|
150
183
|
}
|
|
151
|
-
case
|
|
184
|
+
case "dataverse_execute_function": {
|
|
152
185
|
const { functionName, parameters } = ExecuteFunctionInput.parse(args);
|
|
153
186
|
const result = await client.executeFunction(functionName, parameters);
|
|
154
|
-
return {
|
|
187
|
+
return {
|
|
188
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
|
|
189
|
+
};
|
|
155
190
|
}
|
|
156
|
-
case
|
|
191
|
+
case "dataverse_execute_bound_action": {
|
|
157
192
|
const { entitySetName, id, actionName, parameters } = ExecuteBoundActionInput.parse(args);
|
|
158
193
|
const result = await client.executeBoundAction(entitySetName, id, actionName, parameters);
|
|
159
|
-
return {
|
|
194
|
+
return {
|
|
195
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
|
|
196
|
+
};
|
|
160
197
|
}
|
|
161
|
-
case
|
|
198
|
+
case "dataverse_list_dependencies": {
|
|
162
199
|
const { tableName, componentType } = ListTableDependenciesInput.parse(args);
|
|
163
200
|
const result = await client.listTableDependencies(tableName, componentType);
|
|
164
|
-
return {
|
|
201
|
+
return {
|
|
202
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
|
|
203
|
+
};
|
|
165
204
|
}
|
|
166
|
-
case
|
|
205
|
+
case "dataverse_retrieve_dependencies_for_delete": {
|
|
167
206
|
const { componentType, objectId } = RetrieveDependenciesForDeleteInput.parse(args);
|
|
168
207
|
const result = await client.listDependencies(componentType, objectId);
|
|
169
|
-
return {
|
|
208
|
+
return {
|
|
209
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
|
|
210
|
+
};
|
|
170
211
|
}
|
|
171
|
-
case
|
|
212
|
+
case "dataverse_execute_bound_function": {
|
|
172
213
|
const { entitySetName, id, functionName, parameters } = ExecuteBoundFunctionInput.parse(args);
|
|
173
214
|
const result = await client.executeBoundFunction(entitySetName, id, functionName, parameters);
|
|
174
|
-
return {
|
|
215
|
+
return {
|
|
216
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
|
|
217
|
+
};
|
|
175
218
|
}
|
|
176
219
|
default:
|
|
177
220
|
throw new Error(`Unknown action tool: ${name}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.tools.js","sourceRoot":"","sources":["../../src/tools/actions.tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB;QACE,IAAI,EAAE,0BAA0B;QAChC,WAAW,
|
|
1
|
+
{"version":3,"file":"actions.tools.js","sourceRoot":"","sources":["../../src/tools/actions.tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;A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,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;aACnE,CAAC;QACJ,CAAC;QACD,KAAK,4CAA4C,CAAC,CAAC,CAAC;YAClD,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,GAC/B,kCAAkC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACjD,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,gBAAgB,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;YACtE,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;aACnE,CAAC;QACJ,CAAC;QACD,KAAK,kCAAkC,CAAC,CAAC,CAAC;YACxC,MAAM,EAAE,aAAa,EAAE,EAAE,EAAE,YAAY,EAAE,UAAU,EAAE,GACnD,yBAAyB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACxC,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,oBAAoB,CAC9C,aAAa,EACb,EAAE,EACF,YAAY,EACZ,UAAU,CACX,CAAC;YACF,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;aACnE,CAAC;QACJ,CAAC;QACD;YACE,MAAM,IAAI,KAAK,CAAC,wBAAwB,IAAI,EAAE,CAAC,CAAC;IACpD,CAAC;AACH,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DataverseAdvancedClient } from
|
|
1
|
+
import type { DataverseAdvancedClient } from "../dataverse/dataverse-client-advanced.js";
|
|
2
2
|
export declare const annotationTools: ({
|
|
3
3
|
name: string;
|
|
4
4
|
description: string;
|
|
@@ -75,7 +75,7 @@ export declare const annotationTools: ({
|
|
|
75
75
|
})[];
|
|
76
76
|
export declare function handleAnnotationTool(name: string, args: unknown, client: DataverseAdvancedClient): Promise<{
|
|
77
77
|
content: Array<{
|
|
78
|
-
type:
|
|
78
|
+
type: "text";
|
|
79
79
|
text: string;
|
|
80
80
|
}>;
|
|
81
81
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotations.tools.d.ts","sourceRoot":"","sources":["../../src/tools/annotations.tools.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC;
|
|
1
|
+
{"version":3,"file":"annotations.tools.d.ts","sourceRoot":"","sources":["../../src/tools/annotations.tools.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC;AAyBzF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAwE3B,CAAC;AAEF,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,OAAO,EACb,MAAM,EAAE,uBAAuB,GAC9B,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,CAAC,CAyH7D"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { z } from
|
|
2
|
-
import { esc } from
|
|
3
|
-
import { safeEntitySetName } from
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { esc } from "../dataverse/dataverse-client.utils.js";
|
|
3
|
+
import { safeEntitySetName } from "./validation.utils.js";
|
|
4
4
|
const GetAnnotationsInput = z.object({
|
|
5
5
|
recordId: z.string().uuid(),
|
|
6
6
|
includeContent: z.boolean().optional().default(false),
|
|
7
7
|
top: z.number().int().positive().max(100).optional().default(20),
|
|
8
8
|
mimeTypeFilter: z.string().optional(),
|
|
9
9
|
});
|
|
10
|
-
const CreateAnnotationInput = z
|
|
10
|
+
const CreateAnnotationInput = z
|
|
11
|
+
.object({
|
|
11
12
|
recordId: z.string().uuid(),
|
|
12
13
|
entitySetName: safeEntitySetName,
|
|
13
14
|
notetext: z.string().optional(),
|
|
@@ -15,156 +16,164 @@ const CreateAnnotationInput = z.object({
|
|
|
15
16
|
filename: z.string().optional(),
|
|
16
17
|
mimetype: z.string().optional(),
|
|
17
18
|
documentbody: z.string().optional(),
|
|
18
|
-
})
|
|
19
|
+
})
|
|
20
|
+
.refine((data) => Boolean(data.notetext) || Boolean(data.documentbody), {
|
|
21
|
+
message: "At least one of notetext or documentbody is required",
|
|
22
|
+
});
|
|
19
23
|
export const annotationTools = [
|
|
20
24
|
{
|
|
21
|
-
name:
|
|
22
|
-
description:
|
|
25
|
+
name: "dataverse_get_annotations",
|
|
26
|
+
description: "Retrieves notes and file attachments (annotations) linked to a Dataverse record. Returns note text, file metadata (name, size, MIME type), owner, and timestamps. Set includeContent=true to also retrieve base64 file content (warning: can be very large).",
|
|
23
27
|
inputSchema: {
|
|
24
|
-
type:
|
|
28
|
+
type: "object",
|
|
25
29
|
properties: {
|
|
26
30
|
recordId: {
|
|
27
|
-
type:
|
|
31
|
+
type: "string",
|
|
28
32
|
description: "The parent record's GUID",
|
|
29
33
|
},
|
|
30
34
|
includeContent: {
|
|
31
|
-
type:
|
|
32
|
-
description:
|
|
35
|
+
type: "boolean",
|
|
36
|
+
description: "If true, include documentbody (base64). WARNING: can be very large.",
|
|
33
37
|
default: false,
|
|
34
38
|
},
|
|
35
39
|
top: {
|
|
36
|
-
type:
|
|
37
|
-
description:
|
|
40
|
+
type: "number",
|
|
41
|
+
description: "Maximum number of annotations to return (default 20, max 100)",
|
|
38
42
|
default: 20,
|
|
39
43
|
},
|
|
40
44
|
mimeTypeFilter: {
|
|
41
|
-
type:
|
|
45
|
+
type: "string",
|
|
42
46
|
description: 'Filter by MIME type (e.g. "application/pdf")',
|
|
43
47
|
},
|
|
44
48
|
},
|
|
45
|
-
required: [
|
|
49
|
+
required: ["recordId"],
|
|
46
50
|
},
|
|
47
51
|
},
|
|
48
52
|
{
|
|
49
|
-
name:
|
|
50
|
-
description:
|
|
53
|
+
name: "dataverse_create_annotation",
|
|
54
|
+
description: "Creates a note or file attachment (annotation) linked to a Dataverse record. Provide notetext for a text note, documentbody (base64) for a file attachment, or both. The parent record is identified by entitySetName and recordId.",
|
|
51
55
|
inputSchema: {
|
|
52
|
-
type:
|
|
56
|
+
type: "object",
|
|
53
57
|
properties: {
|
|
54
58
|
recordId: {
|
|
55
|
-
type:
|
|
59
|
+
type: "string",
|
|
56
60
|
description: "The parent record's GUID",
|
|
57
61
|
},
|
|
58
62
|
entitySetName: {
|
|
59
|
-
type:
|
|
63
|
+
type: "string",
|
|
60
64
|
description: 'The OData entity set name of the parent record (e.g., "accounts", "contacts")',
|
|
61
65
|
},
|
|
62
66
|
notetext: {
|
|
63
|
-
type:
|
|
64
|
-
description:
|
|
67
|
+
type: "string",
|
|
68
|
+
description: "Text content of the note",
|
|
65
69
|
},
|
|
66
70
|
subject: {
|
|
67
|
-
type:
|
|
68
|
-
description:
|
|
71
|
+
type: "string",
|
|
72
|
+
description: "Subject/title of the note",
|
|
69
73
|
},
|
|
70
74
|
filename: {
|
|
71
|
-
type:
|
|
72
|
-
description:
|
|
75
|
+
type: "string",
|
|
76
|
+
description: "File name (required when attaching a file)",
|
|
73
77
|
},
|
|
74
78
|
mimetype: {
|
|
75
|
-
type:
|
|
79
|
+
type: "string",
|
|
76
80
|
description: 'MIME type of the file (e.g., "application/pdf")',
|
|
77
81
|
},
|
|
78
82
|
documentbody: {
|
|
79
|
-
type:
|
|
80
|
-
description:
|
|
83
|
+
type: "string",
|
|
84
|
+
description: "Base64-encoded file content",
|
|
81
85
|
},
|
|
82
86
|
},
|
|
83
|
-
required: [
|
|
87
|
+
required: ["recordId", "entitySetName"],
|
|
84
88
|
},
|
|
85
89
|
},
|
|
86
90
|
];
|
|
87
91
|
export async function handleAnnotationTool(name, args, client) {
|
|
88
92
|
switch (name) {
|
|
89
|
-
case
|
|
93
|
+
case "dataverse_get_annotations": {
|
|
90
94
|
const params = GetAnnotationsInput.parse(args);
|
|
91
95
|
const selectFields = [
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
96
|
+
"annotationid",
|
|
97
|
+
"subject",
|
|
98
|
+
"notetext",
|
|
99
|
+
"filename",
|
|
100
|
+
"filesize",
|
|
101
|
+
"mimetype",
|
|
102
|
+
"isdocument",
|
|
103
|
+
"createdon",
|
|
104
|
+
"modifiedon",
|
|
101
105
|
];
|
|
102
106
|
if (params.includeContent) {
|
|
103
|
-
selectFields.push(
|
|
107
|
+
selectFields.push("documentbody");
|
|
104
108
|
}
|
|
105
109
|
const filterParts = [`_objectid_value eq ${params.recordId}`];
|
|
106
110
|
if (params.mimeTypeFilter) {
|
|
107
111
|
filterParts.push(`mimetype eq '${esc(params.mimeTypeFilter)}'`);
|
|
108
112
|
}
|
|
109
|
-
const response = await client.query(
|
|
113
|
+
const response = await client.query("annotations", {
|
|
110
114
|
select: selectFields,
|
|
111
|
-
filter: filterParts.join(
|
|
112
|
-
expand:
|
|
113
|
-
orderby:
|
|
115
|
+
filter: filterParts.join(" and "),
|
|
116
|
+
expand: "ownerid($select=name)",
|
|
117
|
+
orderby: "createdon desc",
|
|
114
118
|
top: params.top,
|
|
115
119
|
});
|
|
116
120
|
const rows = (response.value ?? []);
|
|
117
121
|
const annotations = rows.map((row) => {
|
|
118
122
|
const result = {
|
|
119
|
-
id: row[
|
|
120
|
-
subject: row[
|
|
121
|
-
noteText: row[
|
|
122
|
-
isDocument: row[
|
|
123
|
-
createdOn: row[
|
|
124
|
-
modifiedOn: row[
|
|
125
|
-
owner: row[
|
|
123
|
+
id: row["annotationid"] ?? "",
|
|
124
|
+
subject: row["subject"] ?? null,
|
|
125
|
+
noteText: row["notetext"] ?? null,
|
|
126
|
+
isDocument: row["isdocument"] === true,
|
|
127
|
+
createdOn: row["createdon"] ?? "",
|
|
128
|
+
modifiedOn: row["modifiedon"] ?? "",
|
|
129
|
+
owner: row["ownerid"]?.["name"] ??
|
|
130
|
+
null,
|
|
126
131
|
};
|
|
127
|
-
if (row[
|
|
128
|
-
result.fileName = row[
|
|
129
|
-
result.fileSize = row[
|
|
130
|
-
result.mimeType = row[
|
|
132
|
+
if (row["isdocument"] === true) {
|
|
133
|
+
result.fileName = row["filename"] ?? null;
|
|
134
|
+
result.fileSize = row["filesize"] ?? null;
|
|
135
|
+
result.mimeType = row["mimetype"] ?? null;
|
|
131
136
|
}
|
|
132
|
-
if (params.includeContent && row[
|
|
133
|
-
result.documentBody = row[
|
|
137
|
+
if (params.includeContent && row["documentbody"]) {
|
|
138
|
+
result.documentBody = row["documentbody"];
|
|
134
139
|
}
|
|
135
140
|
return result;
|
|
136
141
|
});
|
|
137
142
|
return {
|
|
138
143
|
content: [
|
|
139
144
|
{
|
|
140
|
-
type:
|
|
141
|
-
text: JSON.stringify({
|
|
145
|
+
type: "text",
|
|
146
|
+
text: JSON.stringify({
|
|
147
|
+
recordId: params.recordId,
|
|
148
|
+
annotations,
|
|
149
|
+
count: annotations.length,
|
|
150
|
+
}, null, 2),
|
|
142
151
|
},
|
|
143
152
|
],
|
|
144
153
|
};
|
|
145
154
|
}
|
|
146
|
-
case
|
|
155
|
+
case "dataverse_create_annotation": {
|
|
147
156
|
const params = CreateAnnotationInput.parse(args);
|
|
148
157
|
const data = {
|
|
149
|
-
|
|
158
|
+
"objectid@odata.bind": `/${params.entitySetName}(${params.recordId})`,
|
|
150
159
|
};
|
|
151
160
|
if (params.notetext !== undefined)
|
|
152
|
-
data[
|
|
161
|
+
data["notetext"] = params.notetext;
|
|
153
162
|
if (params.subject !== undefined)
|
|
154
|
-
data[
|
|
163
|
+
data["subject"] = params.subject;
|
|
155
164
|
if (params.filename !== undefined)
|
|
156
|
-
data[
|
|
165
|
+
data["filename"] = params.filename;
|
|
157
166
|
if (params.mimetype !== undefined)
|
|
158
|
-
data[
|
|
167
|
+
data["mimetype"] = params.mimetype;
|
|
159
168
|
if (params.documentbody !== undefined) {
|
|
160
|
-
data[
|
|
161
|
-
data[
|
|
169
|
+
data["documentbody"] = params.documentbody;
|
|
170
|
+
data["isdocument"] = true;
|
|
162
171
|
}
|
|
163
|
-
const annotationId = await client.createRecord(
|
|
172
|
+
const annotationId = await client.createRecord("annotations", data);
|
|
164
173
|
return {
|
|
165
174
|
content: [
|
|
166
175
|
{
|
|
167
|
-
type:
|
|
176
|
+
type: "text",
|
|
168
177
|
text: JSON.stringify({
|
|
169
178
|
created: true,
|
|
170
179
|
annotationId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotations.tools.js","sourceRoot":"","sources":["../../src/tools/annotations.tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,GAAG,EAAE,MAAM,wCAAwC,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"annotations.tools.js","sourceRoot":"","sources":["../../src/tools/annotations.tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,GAAG,EAAE,MAAM,wCAAwC,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE;IAC3B,cAAc,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,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