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,109 +1,109 @@
|
|
|
1
|
-
import { z } from
|
|
1
|
+
import { z } from "zod";
|
|
2
2
|
export const metadataTools = [
|
|
3
3
|
{
|
|
4
|
-
name:
|
|
5
|
-
description:
|
|
4
|
+
name: "dataverse_list_tables",
|
|
5
|
+
description: "Lists all Dataverse tables. By default returns ONLY custom (non-system) tables. Set includeSystemTables=true to include all ~1700+ system tables.",
|
|
6
6
|
inputSchema: {
|
|
7
|
-
type:
|
|
7
|
+
type: "object",
|
|
8
8
|
properties: {
|
|
9
9
|
includeSystemTables: {
|
|
10
|
-
type:
|
|
11
|
-
description:
|
|
10
|
+
type: "boolean",
|
|
11
|
+
description: "Include system tables. Default false = custom tables only.",
|
|
12
12
|
},
|
|
13
13
|
},
|
|
14
14
|
required: [],
|
|
15
15
|
},
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
|
-
name:
|
|
19
|
-
description:
|
|
18
|
+
name: "dataverse_get_table_metadata",
|
|
19
|
+
description: "Returns full schema metadata for a Dataverse table: all attribute (column) logical names, display names, data types, required levels, and lookup target entities. Use this before writing queries or creating/updating records to confirm correct field names and types. Set includeAttributes=false if you only need table-level metadata without column details.",
|
|
20
20
|
inputSchema: {
|
|
21
|
-
type:
|
|
21
|
+
type: "object",
|
|
22
22
|
properties: {
|
|
23
23
|
logicalName: {
|
|
24
|
-
type:
|
|
24
|
+
type: "string",
|
|
25
25
|
description: 'The logical name of the table (e.g., "account", "contact", "new_mytable")',
|
|
26
26
|
},
|
|
27
27
|
includeAttributes: {
|
|
28
|
-
type:
|
|
29
|
-
description:
|
|
28
|
+
type: "boolean",
|
|
29
|
+
description: "Include attribute (column) definitions. Default: true",
|
|
30
30
|
},
|
|
31
31
|
},
|
|
32
|
-
required: [
|
|
32
|
+
required: ["logicalName"],
|
|
33
33
|
},
|
|
34
34
|
},
|
|
35
35
|
{
|
|
36
|
-
name:
|
|
37
|
-
description:
|
|
36
|
+
name: "dataverse_get_relationships",
|
|
37
|
+
description: "Returns all relationship definitions (1:N, N:1, N:N) for a Dataverse table, including relationship schema names, referenced/referencing entity names, and lookup attribute names. Use to determine the correct relationshipName for dataverse_associate/dataverse_disassociate, or to map lookup fields before building FetchXML joins. Use relationshipType to filter results.",
|
|
38
38
|
inputSchema: {
|
|
39
|
-
type:
|
|
39
|
+
type: "object",
|
|
40
40
|
properties: {
|
|
41
41
|
logicalName: {
|
|
42
|
-
type:
|
|
43
|
-
description:
|
|
42
|
+
type: "string",
|
|
43
|
+
description: "The logical name of the table",
|
|
44
44
|
},
|
|
45
45
|
relationshipType: {
|
|
46
|
-
type:
|
|
47
|
-
enum: [
|
|
48
|
-
description:
|
|
46
|
+
type: "string",
|
|
47
|
+
enum: ["OneToMany", "ManyToOne", "ManyToMany", "All"],
|
|
48
|
+
description: "Filter by relationship type. Default: All",
|
|
49
49
|
},
|
|
50
50
|
},
|
|
51
|
-
required: [
|
|
51
|
+
required: ["logicalName"],
|
|
52
52
|
},
|
|
53
53
|
},
|
|
54
54
|
{
|
|
55
|
-
name:
|
|
56
|
-
description:
|
|
55
|
+
name: "dataverse_list_global_option_sets",
|
|
56
|
+
description: "Lists all global (shared) option sets defined in the Dataverse environment, returning their names and metadata IDs. Use this to discover available option sets before calling dataverse_get_option_set to retrieve their values. Prefer this over dataverse_get_table_metadata when you need to find option sets that are reused across multiple tables.",
|
|
57
57
|
inputSchema: {
|
|
58
|
-
type:
|
|
58
|
+
type: "object",
|
|
59
59
|
properties: {},
|
|
60
60
|
required: [],
|
|
61
61
|
},
|
|
62
62
|
},
|
|
63
63
|
{
|
|
64
|
-
name:
|
|
65
|
-
description:
|
|
64
|
+
name: "dataverse_get_option_set",
|
|
65
|
+
description: "Returns all option labels and their integer values for a named global option set. Use this to look up the numeric code for a picklist value before filtering records (e.g., statecode or statuscode equivalents), or to populate dropdowns with correct option values.",
|
|
66
66
|
inputSchema: {
|
|
67
|
-
type:
|
|
67
|
+
type: "object",
|
|
68
68
|
properties: {
|
|
69
69
|
name: {
|
|
70
|
-
type:
|
|
71
|
-
description:
|
|
70
|
+
type: "string",
|
|
71
|
+
description: "The name of the global option set",
|
|
72
72
|
},
|
|
73
73
|
},
|
|
74
|
-
required: [
|
|
74
|
+
required: ["name"],
|
|
75
75
|
},
|
|
76
76
|
},
|
|
77
77
|
{
|
|
78
|
-
name:
|
|
79
|
-
description:
|
|
78
|
+
name: "dataverse_get_entity_key",
|
|
79
|
+
description: "Returns all alternate key definitions for a Dataverse table. Useful before using dataverse_upsert to know which fields serve as alternate keys, their index status (Active/InProgress/Failed), and whether they are customizable.",
|
|
80
80
|
inputSchema: {
|
|
81
|
-
type:
|
|
81
|
+
type: "object",
|
|
82
82
|
properties: {
|
|
83
83
|
tableName: {
|
|
84
|
-
type:
|
|
84
|
+
type: "string",
|
|
85
85
|
description: 'Logical name of the table (e.g., "account", "contact")',
|
|
86
86
|
},
|
|
87
87
|
},
|
|
88
|
-
required: [
|
|
88
|
+
required: ["tableName"],
|
|
89
89
|
},
|
|
90
90
|
},
|
|
91
91
|
{
|
|
92
|
-
name:
|
|
93
|
-
description:
|
|
92
|
+
name: "dataverse_get_attribute_option_set",
|
|
93
|
+
description: "Returns all option labels and integer values for a table-specific attribute (Picklist, Status, or State field). Use to look up the numeric codes for a column's choices before filtering or updating records.",
|
|
94
94
|
inputSchema: {
|
|
95
|
-
type:
|
|
95
|
+
type: "object",
|
|
96
96
|
properties: {
|
|
97
97
|
entityLogicalName: {
|
|
98
|
-
type:
|
|
98
|
+
type: "string",
|
|
99
99
|
description: 'Logical name of the table (e.g., "account", "contact")',
|
|
100
100
|
},
|
|
101
101
|
attributeLogicalName: {
|
|
102
|
-
type:
|
|
102
|
+
type: "string",
|
|
103
103
|
description: 'Logical name of the attribute (e.g., "statuscode", "industrycode")',
|
|
104
104
|
},
|
|
105
105
|
},
|
|
106
|
-
required: [
|
|
106
|
+
required: ["entityLogicalName", "attributeLogicalName"],
|
|
107
107
|
},
|
|
108
108
|
},
|
|
109
109
|
];
|
|
@@ -113,84 +113,119 @@ const GetTableMetadataInput = z.object({
|
|
|
113
113
|
});
|
|
114
114
|
const GetRelationshipsInput = z.object({
|
|
115
115
|
logicalName: z.string().min(1),
|
|
116
|
-
relationshipType: z
|
|
116
|
+
relationshipType: z
|
|
117
|
+
.enum(["OneToMany", "ManyToOne", "ManyToMany", "All"])
|
|
118
|
+
.optional(),
|
|
117
119
|
});
|
|
118
120
|
const ListTablesInput = z.object({
|
|
119
|
-
includeSystemTables: z
|
|
121
|
+
includeSystemTables: z
|
|
122
|
+
.boolean()
|
|
123
|
+
.default(false)
|
|
124
|
+
.optional()
|
|
125
|
+
.describe("Include system tables. Default false = custom tables only."),
|
|
120
126
|
});
|
|
121
127
|
const GetOptionSetInput = z.object({
|
|
122
128
|
name: z.string().min(1),
|
|
123
129
|
});
|
|
124
130
|
const GetEntityKeyInput = z.object({
|
|
125
|
-
tableName: z
|
|
131
|
+
tableName: z
|
|
132
|
+
.string()
|
|
133
|
+
.min(1)
|
|
134
|
+
.describe('Logical name of the table (e.g., "account", "contact")'),
|
|
126
135
|
});
|
|
127
136
|
const DV_NAME_RE = /^[a-z_][a-z0-9_]*$/;
|
|
128
137
|
const GetAttributeOptionSetInput = z.object({
|
|
129
|
-
entityLogicalName: z
|
|
130
|
-
|
|
138
|
+
entityLogicalName: z
|
|
139
|
+
.string()
|
|
140
|
+
.min(1)
|
|
141
|
+
.regex(DV_NAME_RE, "Invalid Dataverse logical name"),
|
|
142
|
+
attributeLogicalName: z
|
|
143
|
+
.string()
|
|
144
|
+
.min(1)
|
|
145
|
+
.regex(DV_NAME_RE, "Invalid Dataverse logical name"),
|
|
131
146
|
});
|
|
132
147
|
export async function handleMetadataTool(name, args, client) {
|
|
133
148
|
switch (name) {
|
|
134
|
-
case
|
|
149
|
+
case "dataverse_list_tables": {
|
|
135
150
|
const { includeSystemTables = false } = ListTablesInput.parse(args ?? {});
|
|
136
151
|
const customOnly = !includeSystemTables;
|
|
137
152
|
const result = await client.listTables(customOnly);
|
|
138
|
-
return {
|
|
153
|
+
return {
|
|
154
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
|
|
155
|
+
};
|
|
139
156
|
}
|
|
140
|
-
case
|
|
157
|
+
case "dataverse_get_table_metadata": {
|
|
141
158
|
const { logicalName, includeAttributes } = GetTableMetadataInput.parse(args);
|
|
142
159
|
const result = await client.getTableMetadata(logicalName, includeAttributes);
|
|
143
|
-
return {
|
|
160
|
+
return {
|
|
161
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
|
|
162
|
+
};
|
|
144
163
|
}
|
|
145
|
-
case
|
|
164
|
+
case "dataverse_get_relationships": {
|
|
146
165
|
const { logicalName, relationshipType } = GetRelationshipsInput.parse(args);
|
|
147
166
|
const rawRelationships = await client.getRelationships(logicalName);
|
|
148
167
|
const lname = logicalName.toLowerCase();
|
|
149
|
-
const oneToMany = rawRelationships.filter(r => r.RelationshipType ===
|
|
168
|
+
const oneToMany = rawRelationships.filter((r) => r.RelationshipType === "OneToManyRelationship" &&
|
|
150
169
|
r.ReferencedEntity?.toLowerCase() === lname);
|
|
151
|
-
const manyToOne = rawRelationships.filter(r => r.RelationshipType ===
|
|
170
|
+
const manyToOne = rawRelationships.filter((r) => r.RelationshipType === "OneToManyRelationship" &&
|
|
152
171
|
r.ReferencingEntity?.toLowerCase() === lname);
|
|
153
|
-
const manyToMany = rawRelationships.filter(r => r.RelationshipType ===
|
|
154
|
-
const includeAll = !relationshipType || relationshipType ===
|
|
172
|
+
const manyToMany = rawRelationships.filter((r) => r.RelationshipType === "ManyToManyRelationship");
|
|
173
|
+
const includeAll = !relationshipType || relationshipType === "All";
|
|
155
174
|
return {
|
|
156
|
-
content: [
|
|
157
|
-
|
|
175
|
+
content: [
|
|
176
|
+
{
|
|
177
|
+
type: "text",
|
|
158
178
|
text: JSON.stringify({
|
|
159
179
|
tableName: logicalName,
|
|
160
|
-
oneToMany:
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
180
|
+
oneToMany: includeAll || relationshipType === "OneToMany"
|
|
181
|
+
? oneToMany
|
|
182
|
+
: undefined,
|
|
183
|
+
manyToOne: includeAll || relationshipType === "ManyToOne"
|
|
184
|
+
? manyToOne
|
|
185
|
+
: undefined,
|
|
186
|
+
manyToMany: includeAll || relationshipType === "ManyToMany"
|
|
187
|
+
? manyToMany
|
|
188
|
+
: undefined,
|
|
189
|
+
}, null, 2),
|
|
190
|
+
},
|
|
191
|
+
],
|
|
165
192
|
};
|
|
166
193
|
}
|
|
167
|
-
case
|
|
194
|
+
case "dataverse_list_global_option_sets": {
|
|
168
195
|
const result = await client.listGlobalOptionSets();
|
|
169
|
-
return {
|
|
196
|
+
return {
|
|
197
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
|
|
198
|
+
};
|
|
170
199
|
}
|
|
171
|
-
case
|
|
200
|
+
case "dataverse_get_option_set": {
|
|
172
201
|
const { name: optionSetName } = GetOptionSetInput.parse(args);
|
|
173
202
|
const result = await client.getOptionSet(optionSetName);
|
|
174
|
-
return {
|
|
203
|
+
return {
|
|
204
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
|
|
205
|
+
};
|
|
175
206
|
}
|
|
176
|
-
case
|
|
207
|
+
case "dataverse_get_entity_key": {
|
|
177
208
|
const { tableName } = GetEntityKeyInput.parse(args);
|
|
178
209
|
const keys = await client.getEntityKeys(tableName);
|
|
179
210
|
return {
|
|
180
|
-
content: [
|
|
181
|
-
|
|
211
|
+
content: [
|
|
212
|
+
{
|
|
213
|
+
type: "text",
|
|
182
214
|
text: JSON.stringify({ tableName, keys, count: keys.length }, null, 2),
|
|
183
|
-
}
|
|
215
|
+
},
|
|
216
|
+
],
|
|
184
217
|
};
|
|
185
218
|
}
|
|
186
|
-
case
|
|
219
|
+
case "dataverse_get_attribute_option_set": {
|
|
187
220
|
const { entityLogicalName, attributeLogicalName } = GetAttributeOptionSetInput.parse(args);
|
|
188
221
|
const result = await client.getAttributeOptionSet(entityLogicalName, attributeLogicalName);
|
|
189
222
|
return {
|
|
190
|
-
content: [
|
|
191
|
-
|
|
223
|
+
content: [
|
|
224
|
+
{
|
|
225
|
+
type: "text",
|
|
192
226
|
text: JSON.stringify(result, null, 2),
|
|
193
|
-
}
|
|
227
|
+
},
|
|
228
|
+
],
|
|
194
229
|
};
|
|
195
230
|
}
|
|
196
231
|
default:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadata.tools.js","sourceRoot":"","sources":["../../src/tools/metadata.tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B;QACE,IAAI,EAAE,uBAAuB;QAC7B,WAAW,
|
|
1
|
+
{"version":3,"file":"metadata.tools.js","sourceRoot":"","sources":["../../src/tools/metadata.tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B;QACE,IAAI,EAAE,uBAAuB;QAC7B,WAAW,EACT,mJAAmJ;QACrJ,WAAW,EAAE;YACX,IAAI,EAAE,QAAiB;YACvB,UAAU,EAAE;gBACV,mBAAmB,EAAE;oBACnB,IAAI,EAAE,SAAS;oBACf,WAAW,EACT,4DAA4D;iBAC/D;aACF;YACD,QAAQ,EAAE,EAAE;SACb;KACF;IACD;QACE,IAAI,EAAE,8BAA8B;QACpC,WAAW,EACT,oWAAoW;QACtW,WAAW,EAAE;YACX,IAAI,EAAE,QAAiB;YACvB,UAAU,EAAE;gBACV,WAAW,EAAE;oBACX,IAAI,EAAE,QAAQ;oBACd,WAAW,EACT,2EAA2E;iBAC9E;gBACD,iBAAiB,EAAE;oBACjB,IAAI,EAAE,SAAS;oBACf,WAAW,EAAE,uDAAuD;iBACrE;aACF;YACD,QAAQ,EAAE,CAAC,aAAa,CAAC;SAC1B;KACF;IACD;QACE,IAAI,EAAE,6BAA6B;QACnC,WAAW,EACT,iXAAiX;QACnX,WAAW,EAAE;YACX,IAAI,EAAE,QAAiB;YACvB,UAAU,EAAE;gBACV,WAAW,EAAE;oBACX,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,+BAA+B;iBAC7C;gBACD,gBAAgB,EAAE;oBAChB,IAAI,EAAE,QAAQ;oBACd,IAAI,EAAE,CAAC,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,KAAK,CAAC;oBACrD,WAAW,EAAE,2CAA2C;iBACzD;aACF;YACD,QAAQ,EAAE,CAAC,aAAa,CAAC;SAC1B;KACF;IACD;QACE,IAAI,EAAE,mCAAmC;QACzC,WAAW,EACT,0VAA0V;QAC5V,WAAW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1
|
-
import type { DataverseAdvancedClient } from
|
|
1
|
+
import type { DataverseAdvancedClient } from "../dataverse/dataverse-client-advanced.js";
|
|
2
2
|
export declare const orgTools: {
|
|
3
3
|
name: string;
|
|
4
4
|
description: string;
|
|
@@ -19,7 +19,7 @@ export declare const orgTools: {
|
|
|
19
19
|
}[];
|
|
20
20
|
export declare function handleOrgTool(name: string, args: unknown, client: DataverseAdvancedClient): Promise<{
|
|
21
21
|
content: Array<{
|
|
22
|
-
type:
|
|
22
|
+
type: "text";
|
|
23
23
|
text: string;
|
|
24
24
|
}>;
|
|
25
25
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"org.tools.d.ts","sourceRoot":"","sources":["../../src/tools/org.tools.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC;AAOzF,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;GAoBpB,CAAC;AAUF,wBAAsB,aAAa,CACjC,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,
|
|
1
|
+
{"version":3,"file":"org.tools.d.ts","sourceRoot":"","sources":["../../src/tools/org.tools.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC;AAOzF,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;GAoBpB,CAAC;AAUF,wBAAsB,aAAa,CACjC,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,CA6C7D"}
|
package/dist/tools/org.tools.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { z } from
|
|
1
|
+
import { z } from "zod";
|
|
2
2
|
const ListBusinessUnitsInput = z.object({
|
|
3
3
|
top: z.number().int().positive().max(200).optional().default(50),
|
|
4
4
|
includeDisabled: z.boolean().optional().default(false),
|
|
5
5
|
});
|
|
6
6
|
export const orgTools = [
|
|
7
7
|
{
|
|
8
|
-
name:
|
|
9
|
-
description:
|
|
8
|
+
name: "dataverse_list_business_units",
|
|
9
|
+
description: "Lists business units in the Dataverse environment. Returns name, ID, parent business unit ID, disabled status, and creation date. By default only active business units are returned.",
|
|
10
10
|
inputSchema: {
|
|
11
|
-
type:
|
|
11
|
+
type: "object",
|
|
12
12
|
properties: {
|
|
13
13
|
top: {
|
|
14
|
-
type:
|
|
15
|
-
description:
|
|
14
|
+
type: "number",
|
|
15
|
+
description: "Maximum number of results (default 50, max 200)",
|
|
16
16
|
},
|
|
17
17
|
includeDisabled: {
|
|
18
|
-
type:
|
|
19
|
-
description:
|
|
18
|
+
type: "boolean",
|
|
19
|
+
description: "Include disabled business units (default false)",
|
|
20
20
|
},
|
|
21
21
|
},
|
|
22
22
|
required: [],
|
|
@@ -25,16 +25,22 @@ export const orgTools = [
|
|
|
25
25
|
];
|
|
26
26
|
export async function handleOrgTool(name, args, client) {
|
|
27
27
|
switch (name) {
|
|
28
|
-
case
|
|
28
|
+
case "dataverse_list_business_units": {
|
|
29
29
|
const { top, includeDisabled } = ListBusinessUnitsInput.parse(args ?? {});
|
|
30
|
-
const filter = includeDisabled ? undefined :
|
|
31
|
-
const result = await client.query(
|
|
32
|
-
select: [
|
|
30
|
+
const filter = includeDisabled ? undefined : "isdisabled eq false";
|
|
31
|
+
const result = await client.query("businessunits", {
|
|
32
|
+
select: [
|
|
33
|
+
"businessunitid",
|
|
34
|
+
"name",
|
|
35
|
+
"parentbusinessunitid",
|
|
36
|
+
"isdisabled",
|
|
37
|
+
"createdon",
|
|
38
|
+
],
|
|
33
39
|
...(filter ? { filter } : {}),
|
|
34
|
-
orderby:
|
|
40
|
+
orderby: "name asc",
|
|
35
41
|
top,
|
|
36
42
|
});
|
|
37
|
-
const units = result.value.map(bu => ({
|
|
43
|
+
const units = result.value.map((bu) => ({
|
|
38
44
|
id: bu.businessunitid,
|
|
39
45
|
name: bu.name,
|
|
40
46
|
parentBusinessUnitId: bu.parentbusinessunitid ?? null,
|
|
@@ -44,7 +50,7 @@ export async function handleOrgTool(name, args, client) {
|
|
|
44
50
|
return {
|
|
45
51
|
content: [
|
|
46
52
|
{
|
|
47
|
-
type:
|
|
53
|
+
type: "text",
|
|
48
54
|
text: JSON.stringify({ businessUnits: units, count: units.length }, null, 2),
|
|
49
55
|
},
|
|
50
56
|
],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"org.tools.js","sourceRoot":"","sources":["../../src/tools/org.tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;IAChE,eAAe,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;CACvD,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB;QACE,IAAI,EAAE,+BAA+B;QACrC,WAAW,EACT,uLAAuL;QACzL,WAAW,EAAE;YACX,IAAI,EAAE,QAAiB;YACvB,UAAU,EAAE;gBACV,GAAG,EAAE;oBACH,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,iDAAiD;iBAC/D;gBACD,eAAe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AK,CAAC,MAAM,EAAE,EAC7C,IAAI,EACJ,CAAC,CACF;qBACF;iBACF;aACF,CAAC;QACJ,CAAC;QAED;YACE,MAAM,IAAI,KAAK,CAAC,qBAAqB,IAAI,EAAE,CAAC,CAAC;IACjD,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 qualityTools: {
|
|
3
3
|
name: string;
|
|
4
4
|
description: string;
|
|
@@ -23,7 +23,7 @@ export declare const qualityTools: {
|
|
|
23
23
|
}[];
|
|
24
24
|
export declare function handleQualityTool(name: string, args: unknown, client: DataverseAdvancedClient): Promise<{
|
|
25
25
|
content: Array<{
|
|
26
|
-
type:
|
|
26
|
+
type: "text";
|
|
27
27
|
text: string;
|
|
28
28
|
}>;
|
|
29
29
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quality.tools.d.ts","sourceRoot":"","sources":["../../src/tools/quality.tools.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC;AAEzF,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"quality.tools.d.ts","sourceRoot":"","sources":["../../src/tools/quality.tools.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC;AAEzF,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;GAyBxB,CAAC;AAWF,wBAAsB,iBAAiB,CACrC,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,CA2C7D"}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { z } from
|
|
1
|
+
import { z } from "zod";
|
|
2
2
|
export const qualityTools = [
|
|
3
3
|
{
|
|
4
|
-
name:
|
|
5
|
-
description:
|
|
4
|
+
name: "dataverse_detect_duplicates",
|
|
5
|
+
description: "Checks for potential duplicate records before creating. Uses Dataverse built-in duplicate detection rules. Pass the prospective record fields to check against existing records.",
|
|
6
6
|
inputSchema: {
|
|
7
|
-
type:
|
|
7
|
+
type: "object",
|
|
8
8
|
properties: {
|
|
9
9
|
entityLogicalName: {
|
|
10
|
-
type:
|
|
10
|
+
type: "string",
|
|
11
11
|
description: 'Table to check, e.g., "account"',
|
|
12
12
|
},
|
|
13
13
|
record: {
|
|
14
|
-
type:
|
|
15
|
-
description:
|
|
14
|
+
type: "object",
|
|
15
|
+
description: "The prospective record fields to check for duplicates",
|
|
16
16
|
},
|
|
17
17
|
top: {
|
|
18
|
-
type:
|
|
19
|
-
description:
|
|
18
|
+
type: "number",
|
|
19
|
+
description: "Maximum number of duplicates to return (default 5, max 20)",
|
|
20
20
|
},
|
|
21
21
|
},
|
|
22
|
-
required: [
|
|
22
|
+
required: ["entityLogicalName", "record"],
|
|
23
23
|
},
|
|
24
24
|
},
|
|
25
25
|
];
|
|
@@ -27,17 +27,17 @@ const DetectDuplicatesInput = z.object({
|
|
|
27
27
|
entityLogicalName: z
|
|
28
28
|
.string()
|
|
29
29
|
.min(1)
|
|
30
|
-
.regex(/^[a-z_][a-z0-9_]*$/i,
|
|
30
|
+
.regex(/^[a-z_][a-z0-9_]*$/i, "Must be a valid Dataverse logical name"),
|
|
31
31
|
record: z.record(z.string(), z.unknown()),
|
|
32
32
|
top: z.number().int().positive().max(20).optional().default(5),
|
|
33
33
|
});
|
|
34
34
|
export async function handleQualityTool(name, args, client) {
|
|
35
35
|
switch (name) {
|
|
36
|
-
case
|
|
36
|
+
case "dataverse_detect_duplicates": {
|
|
37
37
|
const params = DetectDuplicatesInput.parse(args);
|
|
38
38
|
const body = {
|
|
39
39
|
BusinessEntity: {
|
|
40
|
-
|
|
40
|
+
"@odata.type": `Microsoft.Dynamics.CRM.${params.entityLogicalName}`,
|
|
41
41
|
...params.record,
|
|
42
42
|
},
|
|
43
43
|
MatchingEntityName: params.entityLogicalName,
|
|
@@ -46,21 +46,23 @@ export async function handleQualityTool(name, args, client) {
|
|
|
46
46
|
Count: params.top,
|
|
47
47
|
},
|
|
48
48
|
};
|
|
49
|
-
const raw = (await client.executeAction(
|
|
50
|
-
const duplicates = (raw[
|
|
49
|
+
const raw = (await client.executeAction("RetrieveDuplicates", body));
|
|
50
|
+
const duplicates = (raw["value"] ?? []);
|
|
51
51
|
const result = {
|
|
52
52
|
hasDuplicates: duplicates.length > 0,
|
|
53
53
|
duplicateCount: duplicates.length,
|
|
54
54
|
duplicates: duplicates.map((d) => {
|
|
55
55
|
const clean = {};
|
|
56
56
|
for (const [key, val] of Object.entries(d)) {
|
|
57
|
-
if (!key.startsWith(
|
|
57
|
+
if (!key.startsWith("@"))
|
|
58
58
|
clean[key] = val;
|
|
59
59
|
}
|
|
60
60
|
return clean;
|
|
61
61
|
}),
|
|
62
62
|
};
|
|
63
|
-
return {
|
|
63
|
+
return {
|
|
64
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
|
|
65
|
+
};
|
|
64
66
|
}
|
|
65
67
|
default:
|
|
66
68
|
throw new Error(`Unknown quality tool: ${name}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quality.tools.js","sourceRoot":"","sources":["../../src/tools/quality.tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B;QACE,IAAI,EAAE,6BAA6B;QACnC,WAAW,EACT,kLAAkL;QACpL,WAAW,EAAE;YACX,IAAI,EAAE,QAAiB;YACvB,UAAU,EAAE;gBACV,iBAAiB,E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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,yBAAyB,IAAI,EAAE,CAAC,CAAC;IACrD,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 queryTools: ({
|
|
3
3
|
name: string;
|
|
4
4
|
description: string;
|
|
@@ -113,7 +113,7 @@ export declare const queryTools: ({
|
|
|
113
113
|
})[];
|
|
114
114
|
export declare function handleQueryTool(name: string, args: unknown, client: DataverseAdvancedClient): Promise<{
|
|
115
115
|
content: Array<{
|
|
116
|
-
type:
|
|
116
|
+
type: "text";
|
|
117
117
|
text: string;
|
|
118
118
|
}>;
|
|
119
119
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.tools.d.ts","sourceRoot":"","sources":["../../src/tools/query.tools.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC;AAuBzF,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"query.tools.d.ts","sourceRoot":"","sources":["../../src/tools/query.tools.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC;AAuBzF,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA6FtB,CAAC;AAgCF,wBAAsB,eAAe,CACnC,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,CAkE7D"}
|