mcp-dataverse 0.1.0
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/.env.example +15 -0
- package/CAPABILITIES.md +992 -0
- package/LICENSE +21 -0
- package/README.md +277 -0
- package/config.example.json +11 -0
- package/dist/auth/auth-provider.factory.d.ts +4 -0
- package/dist/auth/auth-provider.factory.d.ts.map +1 -0
- package/dist/auth/auth-provider.factory.js +15 -0
- package/dist/auth/auth-provider.factory.js.map +1 -0
- package/dist/auth/auth-provider.interface.d.ts +21 -0
- package/dist/auth/auth-provider.interface.d.ts.map +1 -0
- package/dist/auth/auth-provider.interface.js +2 -0
- package/dist/auth/auth-provider.interface.js.map +1 -0
- package/dist/auth/msal-auth-provider.d.ts +14 -0
- package/dist/auth/msal-auth-provider.d.ts.map +1 -0
- package/dist/auth/msal-auth-provider.js +62 -0
- package/dist/auth/msal-auth-provider.js.map +1 -0
- package/dist/auth/pac-auth-provider.d.ts +19 -0
- package/dist/auth/pac-auth-provider.d.ts.map +1 -0
- package/dist/auth/pac-auth-provider.js +153 -0
- package/dist/auth/pac-auth-provider.js.map +1 -0
- package/dist/config/config.loader.d.ts +3 -0
- package/dist/config/config.loader.d.ts.map +1 -0
- package/dist/config/config.loader.js +52 -0
- package/dist/config/config.loader.js.map +1 -0
- package/dist/config/config.schema.d.ts +34 -0
- package/dist/config/config.schema.d.ts.map +1 -0
- package/dist/config/config.schema.js +25 -0
- package/dist/config/config.schema.js.map +1 -0
- package/dist/dataverse/dataverse-client-advanced.d.ts +47 -0
- package/dist/dataverse/dataverse-client-advanced.d.ts.map +1 -0
- package/dist/dataverse/dataverse-client-advanced.js +147 -0
- package/dist/dataverse/dataverse-client-advanced.js.map +1 -0
- package/dist/dataverse/dataverse-client.d.ts +49 -0
- package/dist/dataverse/dataverse-client.d.ts.map +1 -0
- package/dist/dataverse/dataverse-client.js +313 -0
- package/dist/dataverse/dataverse-client.js.map +1 -0
- package/dist/dataverse/dataverse-client.metadata.d.ts +40 -0
- package/dist/dataverse/dataverse-client.metadata.d.ts.map +1 -0
- package/dist/dataverse/dataverse-client.metadata.js +121 -0
- package/dist/dataverse/dataverse-client.metadata.js.map +1 -0
- package/dist/dataverse/dataverse-client.utils.d.ts +14 -0
- package/dist/dataverse/dataverse-client.utils.d.ts.map +1 -0
- package/dist/dataverse/dataverse-client.utils.js +65 -0
- package/dist/dataverse/dataverse-client.utils.js.map +1 -0
- package/dist/dataverse/http-client.d.ts +36 -0
- package/dist/dataverse/http-client.d.ts.map +1 -0
- package/dist/dataverse/http-client.js +103 -0
- package/dist/dataverse/http-client.js.map +1 -0
- package/dist/dataverse/types.d.ts +68 -0
- package/dist/dataverse/types.d.ts.map +1 -0
- package/dist/dataverse/types.js +2 -0
- package/dist/dataverse/types.js.map +1 -0
- package/dist/server.d.ts +3 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +165 -0
- package/dist/server.js.map +1 -0
- package/dist/setup-auth.d.ts +2 -0
- package/dist/setup-auth.d.ts.map +1 -0
- package/dist/setup-auth.js +29 -0
- package/dist/setup-auth.js.map +1 -0
- package/dist/tools/actions.tools.d.ts +170 -0
- package/dist/tools/actions.tools.d.ts.map +1 -0
- package/dist/tools/actions.tools.js +179 -0
- package/dist/tools/actions.tools.js.map +1 -0
- package/dist/tools/annotations.tools.d.ts +82 -0
- package/dist/tools/annotations.tools.d.ts.map +1 -0
- package/dist/tools/annotations.tools.js +180 -0
- package/dist/tools/annotations.tools.js.map +1 -0
- package/dist/tools/audit.tools.d.ts +45 -0
- package/dist/tools/audit.tools.d.ts.map +1 -0
- package/dist/tools/audit.tools.js +163 -0
- package/dist/tools/audit.tools.js.map +1 -0
- package/dist/tools/auth.tools.d.ts +17 -0
- package/dist/tools/auth.tools.d.ts.map +1 -0
- package/dist/tools/auth.tools.js +30 -0
- package/dist/tools/auth.tools.js.map +1 -0
- package/dist/tools/batch.tools.d.ts +45 -0
- package/dist/tools/batch.tools.d.ts.map +1 -0
- package/dist/tools/batch.tools.js +71 -0
- package/dist/tools/batch.tools.js.map +1 -0
- package/dist/tools/crud.tools.d.ts +206 -0
- package/dist/tools/crud.tools.d.ts.map +1 -0
- package/dist/tools/crud.tools.js +213 -0
- package/dist/tools/crud.tools.js.map +1 -0
- package/dist/tools/customization.tools.d.ts +75 -0
- package/dist/tools/customization.tools.d.ts.map +1 -0
- package/dist/tools/customization.tools.js +187 -0
- package/dist/tools/customization.tools.js.map +1 -0
- package/dist/tools/environment.tools.d.ts +40 -0
- package/dist/tools/environment.tools.d.ts.map +1 -0
- package/dist/tools/environment.tools.js +145 -0
- package/dist/tools/environment.tools.js.map +1 -0
- package/dist/tools/file.tools.d.ts +61 -0
- package/dist/tools/file.tools.d.ts.map +1 -0
- package/dist/tools/file.tools.js +142 -0
- package/dist/tools/file.tools.js.map +1 -0
- package/dist/tools/impersonate.tools.d.ts +37 -0
- package/dist/tools/impersonate.tools.d.ts.map +1 -0
- package/dist/tools/impersonate.tools.js +85 -0
- package/dist/tools/impersonate.tools.js.map +1 -0
- package/dist/tools/metadata.tools.d.ts +156 -0
- package/dist/tools/metadata.tools.d.ts.map +1 -0
- package/dist/tools/metadata.tools.js +200 -0
- package/dist/tools/metadata.tools.js.map +1 -0
- package/dist/tools/org.tools.d.ts +26 -0
- package/dist/tools/org.tools.d.ts.map +1 -0
- package/dist/tools/org.tools.js +57 -0
- package/dist/tools/org.tools.js.map +1 -0
- package/dist/tools/quality.tools.d.ts +30 -0
- package/dist/tools/quality.tools.d.ts.map +1 -0
- package/dist/tools/quality.tools.js +69 -0
- package/dist/tools/quality.tools.js.map +1 -0
- package/dist/tools/query.tools.d.ts +120 -0
- package/dist/tools/query.tools.d.ts.map +1 -0
- package/dist/tools/query.tools.js +182 -0
- package/dist/tools/query.tools.js.map +1 -0
- package/dist/tools/relations.tools.d.ts +65 -0
- package/dist/tools/relations.tools.d.ts.map +1 -0
- package/dist/tools/relations.tools.js +64 -0
- package/dist/tools/relations.tools.js.map +1 -0
- package/dist/tools/search.tools.d.ts +68 -0
- package/dist/tools/search.tools.d.ts.map +1 -0
- package/dist/tools/search.tools.js +134 -0
- package/dist/tools/search.tools.js.map +1 -0
- package/dist/tools/solution.tools.d.ts +95 -0
- package/dist/tools/solution.tools.d.ts.map +1 -0
- package/dist/tools/solution.tools.js +130 -0
- package/dist/tools/solution.tools.js.map +1 -0
- package/dist/tools/teams.tools.d.ts +27 -0
- package/dist/tools/teams.tools.d.ts.map +1 -0
- package/dist/tools/teams.tools.js +67 -0
- package/dist/tools/teams.tools.js.map +1 -0
- package/dist/tools/trace.tools.d.ts +63 -0
- package/dist/tools/trace.tools.d.ts.map +1 -0
- package/dist/tools/trace.tools.js +218 -0
- package/dist/tools/trace.tools.js.map +1 -0
- package/dist/tools/tracking.tools.d.ts +35 -0
- package/dist/tools/tracking.tools.d.ts.map +1 -0
- package/dist/tools/tracking.tools.js +40 -0
- package/dist/tools/tracking.tools.js.map +1 -0
- package/dist/tools/users.tools.d.ts +57 -0
- package/dist/tools/users.tools.d.ts.map +1 -0
- package/dist/tools/users.tools.js +146 -0
- package/dist/tools/users.tools.js.map +1 -0
- package/dist/tools/views.tools.d.ts +30 -0
- package/dist/tools/views.tools.d.ts.map +1 -0
- package/dist/tools/views.tools.js +84 -0
- package/dist/tools/views.tools.js.map +1 -0
- package/package.json +81 -0
- package/server.json +30 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
const ListSolutionsInput = z.object({
|
|
3
|
+
includeManaged: z.boolean().optional().default(false),
|
|
4
|
+
nameFilter: z.string().optional(),
|
|
5
|
+
top: z.number().int().min(1).max(200).optional().default(50),
|
|
6
|
+
});
|
|
7
|
+
const SolutionComponentsInput = z.object({
|
|
8
|
+
solutionName: z.string().min(1).describe('Unique name of the solution (not the display name)'),
|
|
9
|
+
componentType: z
|
|
10
|
+
.number()
|
|
11
|
+
.int()
|
|
12
|
+
.optional()
|
|
13
|
+
.describe('Filter by Dataverse component type code (1=Entity, 29=Workflow, 97=WebResource, 90=PluginAssembly, etc.). Omit for all types.'),
|
|
14
|
+
top: z.number().int().min(1).max(5000).default(200).optional(),
|
|
15
|
+
});
|
|
16
|
+
const PublishCustomizationsInput = z.object({
|
|
17
|
+
components: z
|
|
18
|
+
.object({
|
|
19
|
+
entities: z.array(z.string()).optional().describe('Entity logical names to publish'),
|
|
20
|
+
webResources: z.array(z.string()).optional().describe('Web resource names to publish'),
|
|
21
|
+
optionSets: z.array(z.string()).optional().describe('Global OptionSet names to publish'),
|
|
22
|
+
})
|
|
23
|
+
.optional()
|
|
24
|
+
.describe('Specific components to publish. If omitted, ALL unpublished customizations are published.'),
|
|
25
|
+
});
|
|
26
|
+
export const solutionTools = [
|
|
27
|
+
{
|
|
28
|
+
name: 'dataverse_list_solutions',
|
|
29
|
+
description: 'Lists Dataverse solutions in the environment. By default returns only unmanaged solutions. Set includeManaged=true to include managed (imported) solutions. Use nameFilter to search by unique name.',
|
|
30
|
+
inputSchema: {
|
|
31
|
+
type: 'object',
|
|
32
|
+
properties: {
|
|
33
|
+
includeManaged: {
|
|
34
|
+
type: 'boolean',
|
|
35
|
+
description: 'Include managed (imported) solutions. Default: false',
|
|
36
|
+
},
|
|
37
|
+
nameFilter: {
|
|
38
|
+
type: 'string',
|
|
39
|
+
description: 'Filter solutions by unique name (contains match)',
|
|
40
|
+
},
|
|
41
|
+
top: {
|
|
42
|
+
type: 'number',
|
|
43
|
+
description: 'Maximum number of solutions to return (default 50, max 200)',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
required: [],
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: 'dataverse_solution_components',
|
|
51
|
+
description: 'Lists all components in a named Dataverse solution (entities, attributes, workflows, web resources, plugins, etc.). Use the unique solution name (not display name). Optionally filter by component type code (1=Entity, 29=Workflow, 97=WebResource, 90=PluginAssembly).',
|
|
52
|
+
inputSchema: {
|
|
53
|
+
type: 'object',
|
|
54
|
+
properties: {
|
|
55
|
+
solutionName: { type: 'string', description: 'Unique name of the solution' },
|
|
56
|
+
componentType: { type: 'number', description: 'Filter by component type code' },
|
|
57
|
+
top: { type: 'number', description: 'Max results (default 200, max 5000)' },
|
|
58
|
+
},
|
|
59
|
+
required: ['solutionName'],
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: 'dataverse_publish_customizations',
|
|
64
|
+
description: 'Publishes unpublished Dataverse customizations. Without parameters, publishes ALL pending customizations (equivalent to clicking "Publish All" in Power Apps maker portal). Optionally specify entities, webResources, or optionSets to publish only those components. WARNING: Publishing all can take 30-120 seconds in large environments.',
|
|
65
|
+
inputSchema: {
|
|
66
|
+
type: 'object',
|
|
67
|
+
properties: {
|
|
68
|
+
components: {
|
|
69
|
+
type: 'object',
|
|
70
|
+
description: 'Specific components. Omit to publish all.',
|
|
71
|
+
properties: {
|
|
72
|
+
entities: { type: 'array', items: { type: 'string' } },
|
|
73
|
+
webResources: { type: 'array', items: { type: 'string' } },
|
|
74
|
+
optionSets: { type: 'array', items: { type: 'string' } },
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
required: [],
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
];
|
|
82
|
+
export async function handleSolutionTool(name, args, client) {
|
|
83
|
+
switch (name) {
|
|
84
|
+
case 'dataverse_list_solutions': {
|
|
85
|
+
const params = ListSolutionsInput.parse(args ?? {});
|
|
86
|
+
const filterParts = ['isvisible eq true'];
|
|
87
|
+
if (!params.includeManaged) {
|
|
88
|
+
filterParts.push('ismanaged eq false');
|
|
89
|
+
}
|
|
90
|
+
if (params.nameFilter) {
|
|
91
|
+
filterParts.push(`contains(uniquename,'${params.nameFilter.replace(/'/g, "''")}')`);
|
|
92
|
+
}
|
|
93
|
+
const result = await client.query('solutions', {
|
|
94
|
+
select: ['solutionid', 'uniquename', 'friendlyname', 'version', 'ismanaged', 'installedon'],
|
|
95
|
+
filter: filterParts.join(' and '),
|
|
96
|
+
expand: 'publisherid($select=friendlyname)',
|
|
97
|
+
orderby: 'friendlyname asc',
|
|
98
|
+
top: params.top,
|
|
99
|
+
});
|
|
100
|
+
const solutions = (result.value ?? []).map(s => ({
|
|
101
|
+
solutionId: s['solutionid'],
|
|
102
|
+
uniqueName: s['uniquename'],
|
|
103
|
+
friendlyName: s['friendlyname'],
|
|
104
|
+
version: s['version'],
|
|
105
|
+
isManaged: s['ismanaged'],
|
|
106
|
+
installedOn: s['installedon'],
|
|
107
|
+
publisher: s['publisherid']?.['friendlyname'] ?? null,
|
|
108
|
+
}));
|
|
109
|
+
return {
|
|
110
|
+
content: [{
|
|
111
|
+
type: 'text',
|
|
112
|
+
text: JSON.stringify({ solutions, count: solutions.length }, null, 2),
|
|
113
|
+
}],
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
case 'dataverse_solution_components': {
|
|
117
|
+
const { solutionName, componentType, top = 200 } = SolutionComponentsInput.parse(args);
|
|
118
|
+
const result = await client.getSolutionComponents(solutionName, componentType, top);
|
|
119
|
+
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
|
120
|
+
}
|
|
121
|
+
case 'dataverse_publish_customizations': {
|
|
122
|
+
const { components } = PublishCustomizationsInput.parse(args ?? {});
|
|
123
|
+
const result = await client.publishCustomizations(components);
|
|
124
|
+
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
|
125
|
+
}
|
|
126
|
+
default:
|
|
127
|
+
throw new Error(`Unknown solution tool: ${name}`);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
//# sourceMappingURL=solution.tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"solution.tools.js","sourceRoot":"","sources":["../../src/tools/solution.tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,kBAAkB,GAAG,CAAC,CAAC,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GAAG,MAAM,MAAM,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC;YAC9D,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;QAChF,CAAC;QACD;YACE,MAAM,IAAI,KAAK,CAAC,0BAA0B,IAAI,EAAE,CAAC,CAAC;IACtD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { DataverseAdvancedClient } from '../dataverse/dataverse-client-advanced.js';
|
|
2
|
+
export declare const teamTools: {
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: "object";
|
|
7
|
+
properties: {
|
|
8
|
+
top: {
|
|
9
|
+
type: string;
|
|
10
|
+
description: string;
|
|
11
|
+
};
|
|
12
|
+
teamType: {
|
|
13
|
+
type: string;
|
|
14
|
+
enum: number[];
|
|
15
|
+
description: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
required: never[];
|
|
19
|
+
};
|
|
20
|
+
}[];
|
|
21
|
+
export declare function handleTeamTool(name: string, args: unknown, client: DataverseAdvancedClient): Promise<{
|
|
22
|
+
content: Array<{
|
|
23
|
+
type: 'text';
|
|
24
|
+
text: string;
|
|
25
|
+
}>;
|
|
26
|
+
}>;
|
|
27
|
+
//# sourceMappingURL=teams.tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"teams.tools.d.ts","sourceRoot":"","sources":["../../src/tools/teams.tools.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC;AAczF,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;GAsBrB,CAAC;AAEF,wBAAsB,cAAc,CAClC,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,CAqC7D"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
const TEAM_TYPE_LABELS = {
|
|
3
|
+
0: 'Owner',
|
|
4
|
+
1: 'Access',
|
|
5
|
+
2: 'Office',
|
|
6
|
+
3: 'Security',
|
|
7
|
+
};
|
|
8
|
+
const ListTeamsInput = z.object({
|
|
9
|
+
top: z.number().int().positive().max(200).optional().default(50),
|
|
10
|
+
teamType: z.union([z.literal(0), z.literal(1), z.literal(2), z.literal(3)]).optional(),
|
|
11
|
+
});
|
|
12
|
+
export const teamTools = [
|
|
13
|
+
{
|
|
14
|
+
name: 'dataverse_list_teams',
|
|
15
|
+
description: 'Lists Dataverse teams in the environment. Useful for finding team owners for record assignment and sharing. ' +
|
|
16
|
+
'teamtype: 0=Owner, 1=Access, 2=AAD Office Group, 3=AAD Security Group.',
|
|
17
|
+
inputSchema: {
|
|
18
|
+
type: 'object',
|
|
19
|
+
properties: {
|
|
20
|
+
top: {
|
|
21
|
+
type: 'number',
|
|
22
|
+
description: 'Maximum number of teams to return (1–200, default 50)',
|
|
23
|
+
},
|
|
24
|
+
teamType: {
|
|
25
|
+
type: 'number',
|
|
26
|
+
enum: [0, 1, 2, 3],
|
|
27
|
+
description: 'Filter by team type: 0=Owner, 1=Access, 2=Office Group, 3=Security Group',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
required: [],
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
];
|
|
34
|
+
export async function handleTeamTool(name, args, client) {
|
|
35
|
+
switch (name) {
|
|
36
|
+
case 'dataverse_list_teams': {
|
|
37
|
+
const { top, teamType } = ListTeamsInput.parse(args);
|
|
38
|
+
const select = [
|
|
39
|
+
'teamid',
|
|
40
|
+
'name',
|
|
41
|
+
'teamtype',
|
|
42
|
+
'description',
|
|
43
|
+
'isdefault',
|
|
44
|
+
'createdon',
|
|
45
|
+
'_businessunitid_value',
|
|
46
|
+
];
|
|
47
|
+
const queryOptions = { select, top, orderby: 'name asc' };
|
|
48
|
+
if (teamType !== undefined) {
|
|
49
|
+
queryOptions.filter = `teamtype eq ${teamType}`;
|
|
50
|
+
}
|
|
51
|
+
const result = await client.query('teams', queryOptions);
|
|
52
|
+
const teams = result.value.map(team => ({
|
|
53
|
+
...team,
|
|
54
|
+
teamTypeName: TEAM_TYPE_LABELS[team['teamtype']] ?? 'Unknown',
|
|
55
|
+
}));
|
|
56
|
+
return {
|
|
57
|
+
content: [{
|
|
58
|
+
type: 'text',
|
|
59
|
+
text: JSON.stringify({ teams, count: teams.length }, null, 2),
|
|
60
|
+
}],
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
default:
|
|
64
|
+
throw new Error(`Unknown team tool: ${name}`);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=teams.tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"teams.tools.js","sourceRoot":"","sources":["../../src/tools/teams.tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,gBAAgB,GAA2B;IAC/C,CAAC,EAAE,OAAO;IACV,CAAC,EAAE,QAAQ;IACX,CAAC,EAAE,QAAQ;IACX,CAAC,EAAE,UAAU;CACd,CAAC;AAEF,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9B,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,QAAQ,EAAE,CAAC,CAA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AC;YACD,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,KAAK,CAA0B,OAAO,EAAE,YAAY,CAAC,CAAC;YAClF,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;gBACtC,GAAG,IAAI;gBACP,YAAY,EAAE,gBAAgB,CAAC,IAAI,CAAC,UAAU,CAAW,CAAC,IAAI,SAAS;aACxE,CAAC,CAAC,CAAC;YACJ,OAAO;gBACL,OAAO,EAAE,CAAC;wBACR,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;qBAC9D,CAAC;aACH,CAAC;QACJ,CAAC;QACD;YACE,MAAM,IAAI,KAAK,CAAC,sBAAsB,IAAI,EAAE,CAAC,CAAC;IAClD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { DataverseAdvancedClient } from '../dataverse/dataverse-client-advanced.js';
|
|
2
|
+
export declare const traceTools: ({
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: "object";
|
|
7
|
+
properties: {
|
|
8
|
+
top: {
|
|
9
|
+
type: string;
|
|
10
|
+
description: string;
|
|
11
|
+
};
|
|
12
|
+
pluginTypeFilter: {
|
|
13
|
+
type: string;
|
|
14
|
+
description: string;
|
|
15
|
+
};
|
|
16
|
+
messageFilter: {
|
|
17
|
+
type: string;
|
|
18
|
+
description: string;
|
|
19
|
+
};
|
|
20
|
+
entityFilter: {
|
|
21
|
+
type: string;
|
|
22
|
+
description: string;
|
|
23
|
+
};
|
|
24
|
+
exceptionsOnly: {
|
|
25
|
+
type: string;
|
|
26
|
+
description: string;
|
|
27
|
+
};
|
|
28
|
+
failedOnly?: never;
|
|
29
|
+
};
|
|
30
|
+
required: never[];
|
|
31
|
+
};
|
|
32
|
+
} | {
|
|
33
|
+
name: string;
|
|
34
|
+
description: string;
|
|
35
|
+
inputSchema: {
|
|
36
|
+
type: "object";
|
|
37
|
+
properties: {
|
|
38
|
+
top: {
|
|
39
|
+
type: string;
|
|
40
|
+
description: string;
|
|
41
|
+
};
|
|
42
|
+
failedOnly: {
|
|
43
|
+
type: string;
|
|
44
|
+
description: string;
|
|
45
|
+
};
|
|
46
|
+
entityFilter: {
|
|
47
|
+
type: string;
|
|
48
|
+
description: string;
|
|
49
|
+
};
|
|
50
|
+
pluginTypeFilter?: never;
|
|
51
|
+
messageFilter?: never;
|
|
52
|
+
exceptionsOnly?: never;
|
|
53
|
+
};
|
|
54
|
+
required: never[];
|
|
55
|
+
};
|
|
56
|
+
})[];
|
|
57
|
+
export declare function handleTraceTool(name: string, args: unknown, client: DataverseAdvancedClient): Promise<{
|
|
58
|
+
content: Array<{
|
|
59
|
+
type: 'text';
|
|
60
|
+
text: string;
|
|
61
|
+
}>;
|
|
62
|
+
}>;
|
|
63
|
+
//# sourceMappingURL=trace.tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trace.tools.d.ts","sourceRoot":"","sources":["../../src/tools/trace.tools.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC;AA2DzF,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAuDtB,CAAC;AAwBF,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,CA8G7D"}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
const OPERATION_TYPE_NAMES = {
|
|
3
|
+
0: 'Execute',
|
|
4
|
+
1: 'Create',
|
|
5
|
+
2: 'Retrieve',
|
|
6
|
+
3: 'RetrieveMultiple',
|
|
7
|
+
4: 'GetParent',
|
|
8
|
+
5: 'Update',
|
|
9
|
+
6: 'Delete',
|
|
10
|
+
7: 'Assign',
|
|
11
|
+
};
|
|
12
|
+
const STATUS_CODE_NAMES = {
|
|
13
|
+
0: 'Waiting',
|
|
14
|
+
10: 'WaitingForResources',
|
|
15
|
+
20: 'InProgress',
|
|
16
|
+
21: 'Pausing',
|
|
17
|
+
22: 'Canceling',
|
|
18
|
+
30: 'Succeeded',
|
|
19
|
+
31: 'Failed',
|
|
20
|
+
32: 'Canceled',
|
|
21
|
+
};
|
|
22
|
+
const STATE_CODE_NAMES = {
|
|
23
|
+
0: 'ReadyToRun',
|
|
24
|
+
1: 'Suspended',
|
|
25
|
+
2: 'Locked',
|
|
26
|
+
3: 'Completed',
|
|
27
|
+
};
|
|
28
|
+
const PLUGIN_TRACE_SELECT = [
|
|
29
|
+
'plugintracelogid',
|
|
30
|
+
'typename',
|
|
31
|
+
'messagename',
|
|
32
|
+
'primaryentity',
|
|
33
|
+
'depth',
|
|
34
|
+
'operationtype',
|
|
35
|
+
'exceptiondetails',
|
|
36
|
+
'messageblock',
|
|
37
|
+
'createdon',
|
|
38
|
+
'performanceexecutionduration',
|
|
39
|
+
'correlationid',
|
|
40
|
+
'requestid',
|
|
41
|
+
];
|
|
42
|
+
const WORKFLOW_TRACE_SELECT = [
|
|
43
|
+
'asyncoperationid',
|
|
44
|
+
'name',
|
|
45
|
+
'operationtype',
|
|
46
|
+
'statuscode',
|
|
47
|
+
'statecode',
|
|
48
|
+
'message',
|
|
49
|
+
'createdon',
|
|
50
|
+
'startedon',
|
|
51
|
+
'completedon',
|
|
52
|
+
'regardingobjecttypecode',
|
|
53
|
+
];
|
|
54
|
+
export const traceTools = [
|
|
55
|
+
{
|
|
56
|
+
name: 'dataverse_get_plugin_trace_logs',
|
|
57
|
+
description: "Retrieves recent plugin and custom workflow activity trace logs from Dataverse. Shows execution details including plugin type name, triggering message, entity, execution duration, trace messages written by the developer, and exception details if the plugin failed. Requires the Plugin Trace Log feature to be enabled in Dataverse settings (Settings > Administration > System Settings > Customization tab > 'Enable logging to plugin trace log'). Essential for debugging plugin failures in production.",
|
|
58
|
+
inputSchema: {
|
|
59
|
+
type: 'object',
|
|
60
|
+
properties: {
|
|
61
|
+
top: {
|
|
62
|
+
type: 'number',
|
|
63
|
+
description: 'Max records to return (default 50, max 200)',
|
|
64
|
+
},
|
|
65
|
+
pluginTypeFilter: {
|
|
66
|
+
type: 'string',
|
|
67
|
+
description: "Filter by plugin type name (substring match, e.g. 'AccountValidation')",
|
|
68
|
+
},
|
|
69
|
+
messageFilter: {
|
|
70
|
+
type: 'string',
|
|
71
|
+
description: "Filter by message name (e.g. 'Create', 'Update')",
|
|
72
|
+
},
|
|
73
|
+
entityFilter: {
|
|
74
|
+
type: 'string',
|
|
75
|
+
description: "Filter by entity logical name (e.g. 'account')",
|
|
76
|
+
},
|
|
77
|
+
exceptionsOnly: {
|
|
78
|
+
type: 'boolean',
|
|
79
|
+
description: 'Return only traces where an exception occurred (default false)',
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
required: [],
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: 'dataverse_get_workflow_trace_logs',
|
|
87
|
+
description: 'Retrieves background workflow (Power Automate classic / legacy workflow engine) execution records from Dataverse. These are the AsyncOperation records for workflow-type operations, useful for diagnosing failures in background workflows and real-time workflows running asynchronously. Note: For modern cloud flows (Power Automate), use the Power Automate portal instead.',
|
|
88
|
+
inputSchema: {
|
|
89
|
+
type: 'object',
|
|
90
|
+
properties: {
|
|
91
|
+
top: {
|
|
92
|
+
type: 'number',
|
|
93
|
+
description: 'Max records (default 50, max 200)',
|
|
94
|
+
},
|
|
95
|
+
failedOnly: {
|
|
96
|
+
type: 'boolean',
|
|
97
|
+
description: 'Return only failed workflows (statuscode eq 31, default false)',
|
|
98
|
+
},
|
|
99
|
+
entityFilter: {
|
|
100
|
+
type: 'string',
|
|
101
|
+
description: "Filter by regarding entity type (e.g. 'account')",
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
required: [],
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
];
|
|
108
|
+
const GetPluginTraceInput = z.object({
|
|
109
|
+
top: z.number().int().positive().max(200).optional().default(50),
|
|
110
|
+
pluginTypeFilter: z.string().optional(),
|
|
111
|
+
messageFilter: z.string().optional(),
|
|
112
|
+
entityFilter: z.string().optional(),
|
|
113
|
+
exceptionsOnly: z.boolean().optional().default(false),
|
|
114
|
+
});
|
|
115
|
+
const GetWorkflowTraceInput = z.object({
|
|
116
|
+
top: z.number().int().positive().max(200).optional().default(50),
|
|
117
|
+
failedOnly: z.boolean().optional().default(false),
|
|
118
|
+
entityFilter: z.string().optional(),
|
|
119
|
+
});
|
|
120
|
+
function str(val) {
|
|
121
|
+
return typeof val === 'string' ? val : '';
|
|
122
|
+
}
|
|
123
|
+
function numOrNull(val) {
|
|
124
|
+
return typeof val === 'number' ? val : null;
|
|
125
|
+
}
|
|
126
|
+
export async function handleTraceTool(name, args, client) {
|
|
127
|
+
switch (name) {
|
|
128
|
+
case 'dataverse_get_plugin_trace_logs': {
|
|
129
|
+
const params = GetPluginTraceInput.parse(args);
|
|
130
|
+
const filterParts = [];
|
|
131
|
+
if (params.pluginTypeFilter) {
|
|
132
|
+
filterParts.push(`contains(typename,'${params.pluginTypeFilter.replace(/'/g, "''")}')`);
|
|
133
|
+
}
|
|
134
|
+
if (params.messageFilter) {
|
|
135
|
+
filterParts.push(`messagename eq '${params.messageFilter.replace(/'/g, "''")}'`);
|
|
136
|
+
}
|
|
137
|
+
if (params.entityFilter) {
|
|
138
|
+
filterParts.push(`primaryentity eq '${params.entityFilter.replace(/'/g, "''")}'`);
|
|
139
|
+
}
|
|
140
|
+
if (params.exceptionsOnly) {
|
|
141
|
+
filterParts.push('exceptiondetails ne null');
|
|
142
|
+
}
|
|
143
|
+
const filter = filterParts.length > 0 ? filterParts.join(' and ') : undefined;
|
|
144
|
+
const response = await client.query('plugintracelog', {
|
|
145
|
+
select: PLUGIN_TRACE_SELECT,
|
|
146
|
+
orderby: 'createdon desc',
|
|
147
|
+
top: params.top,
|
|
148
|
+
...(filter !== undefined ? { filter } : {}),
|
|
149
|
+
});
|
|
150
|
+
const rows = (response.value ?? []);
|
|
151
|
+
const logs = rows.map((row) => {
|
|
152
|
+
const opType = typeof row['operationtype'] === 'number' ? row['operationtype'] : 0;
|
|
153
|
+
const exceptionDetails = row['exceptiondetails'];
|
|
154
|
+
return {
|
|
155
|
+
id: str(row['plugintracelogid']),
|
|
156
|
+
typeName: str(row['typename']),
|
|
157
|
+
message: str(row['messagename']),
|
|
158
|
+
entity: str(row['primaryentity']),
|
|
159
|
+
depth: typeof row['depth'] === 'number' ? row['depth'] : 0,
|
|
160
|
+
operationType: opType,
|
|
161
|
+
operationTypeName: OPERATION_TYPE_NAMES[opType] ?? String(opType),
|
|
162
|
+
createdOn: str(row['createdon']),
|
|
163
|
+
durationMs: numOrNull(row['performanceexecutionduration']),
|
|
164
|
+
correlationId: str(row['correlationid']),
|
|
165
|
+
requestId: str(row['requestid']),
|
|
166
|
+
hasException: exceptionDetails != null && exceptionDetails !== '',
|
|
167
|
+
exceptionDetails: typeof exceptionDetails === 'string' ? exceptionDetails : null,
|
|
168
|
+
messageBlock: typeof row['messageblock'] === 'string' ? row['messageblock'] : null,
|
|
169
|
+
};
|
|
170
|
+
});
|
|
171
|
+
const result = { total: logs.length, logs };
|
|
172
|
+
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
|
173
|
+
}
|
|
174
|
+
case 'dataverse_get_workflow_trace_logs': {
|
|
175
|
+
const params = GetWorkflowTraceInput.parse(args);
|
|
176
|
+
const filterParts = ['operationtype eq 10'];
|
|
177
|
+
if (params.failedOnly) {
|
|
178
|
+
filterParts.push('statuscode eq 31');
|
|
179
|
+
}
|
|
180
|
+
if (params.entityFilter) {
|
|
181
|
+
filterParts.push(`regardingobjecttypecode eq '${params.entityFilter.replace(/'/g, "''")}'`);
|
|
182
|
+
}
|
|
183
|
+
const filter = filterParts.join(' and ');
|
|
184
|
+
const response = await client.query('asyncoperations', {
|
|
185
|
+
select: WORKFLOW_TRACE_SELECT,
|
|
186
|
+
filter,
|
|
187
|
+
orderby: 'createdon desc',
|
|
188
|
+
top: params.top,
|
|
189
|
+
});
|
|
190
|
+
const rows = (response.value ?? []);
|
|
191
|
+
const workflows = rows.map((row) => {
|
|
192
|
+
const statusCode = typeof row['statuscode'] === 'number' ? row['statuscode'] : 0;
|
|
193
|
+
const stateCode = typeof row['statecode'] === 'number' ? row['statecode'] : 0;
|
|
194
|
+
const errorMsg = row['message'];
|
|
195
|
+
return {
|
|
196
|
+
id: str(row['asyncoperationid']),
|
|
197
|
+
name: str(row['name']),
|
|
198
|
+
statusCode,
|
|
199
|
+
statusName: STATUS_CODE_NAMES[statusCode] ?? String(statusCode),
|
|
200
|
+
stateCode,
|
|
201
|
+
stateName: STATE_CODE_NAMES[stateCode] ?? String(stateCode),
|
|
202
|
+
createdOn: str(row['createdon']),
|
|
203
|
+
startedOn: typeof row['startedon'] === 'string' ? row['startedon'] : null,
|
|
204
|
+
completedOn: typeof row['completedon'] === 'string' ? row['completedon'] : null,
|
|
205
|
+
regardingEntityType: typeof row['regardingobjecttypecode'] === 'string'
|
|
206
|
+
? row['regardingobjecttypecode']
|
|
207
|
+
: null,
|
|
208
|
+
errorMessage: typeof errorMsg === 'string' ? errorMsg : null,
|
|
209
|
+
};
|
|
210
|
+
});
|
|
211
|
+
const result = { total: workflows.length, workflows };
|
|
212
|
+
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
|
213
|
+
}
|
|
214
|
+
default:
|
|
215
|
+
throw new Error(`Unknown trace tool: ${name}`);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
//# sourceMappingURL=trace.tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trace.tools.js","sourceRoot":"","sources":["../../src/tools/trace.tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,oBAAoB,GAA2B;IACnD,CAAC,EAAE,SAAS;IACZ,CAAC,EAAE,QAAQ;IACX,CAAC,EAAE,UAAU;IACb,CAAC,EAAE,kBAAkB;IACrB,CAAC,EAAE,WAAW;IACd,CAAC,EAAE,QAAQ;IACX,CAAC,EAAE,QAAQ;IACX,CAAC,EAAE,QAAQ;CACZ,CAAC;AAEF,MAAM,iBAAiB,GAA2B;IAChD,CAAC,EAAE,SAAS;IACZ,EAAE,EAAE,qBAAqB;IACzB,EAAE,EAAE,YAAY;IAChB,EAAE,EAAE,SAAS;IACb,EAAE,EAAE,WAAW;IACf,EAAE,EAAE,WAAW;IACf,EAAE,EAAE,QAAQ;IACZ,EAAE,EAAE,UAAU;CACf,CAAC;AAEF,MAAM,gBAAgB,GAA2B;IAC/C,CAAC,EAAE,YAAY;IACf,CAAC,EAAE,WAAW;IACd,CAAC,EAAE,QAAQ;IACX,CAAC,EAAE,WAAW;CACf,CAAC;AAEF,MAAM,mBAAmB,GAAG;IAC1B,kBAAkB;IAClB,UAAU;IACV,aAAa;IACb,eAAe;IACf,OAAO;IACP,eAAe;IACf,kBAAkB;IAClB,cAAc;IACd,WAAW;IACX,8BAA8B;IAC9B,eAAe;IACf,WAAW;CACZ,CAAC;AAEF,MAAM,qBAAqB,GAAG;IAC5B,kBAAkB;IAClB,MAAM;IACN,eAAe;IACf,YAAY;IACZ,WAAW;IACX,SAAS;IACT,WAAW;IACX,WAAW;IACX,aAAa;IACb,yBAAyB;CAC1B,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB;Q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AAC,EAAE,CAAC;QAChF,CAAC;QAED;YACE,MAAM,IAAI,KAAK,CAAC,uBAAuB,IAAI,EAAE,CAAC,CAAC;IACnD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { DataverseAdvancedClient } from '../dataverse/dataverse-client-advanced.js';
|
|
2
|
+
export declare const trackingTools: {
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: "object";
|
|
7
|
+
properties: {
|
|
8
|
+
entitySetName: {
|
|
9
|
+
type: string;
|
|
10
|
+
description: string;
|
|
11
|
+
};
|
|
12
|
+
deltaToken: {
|
|
13
|
+
anyOf: {
|
|
14
|
+
type: string;
|
|
15
|
+
}[];
|
|
16
|
+
description: string;
|
|
17
|
+
};
|
|
18
|
+
select: {
|
|
19
|
+
type: string;
|
|
20
|
+
items: {
|
|
21
|
+
type: string;
|
|
22
|
+
};
|
|
23
|
+
description: string;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
required: string[];
|
|
27
|
+
};
|
|
28
|
+
}[];
|
|
29
|
+
export declare function handleTrackingTool(name: string, args: unknown, client: DataverseAdvancedClient): Promise<{
|
|
30
|
+
content: Array<{
|
|
31
|
+
type: 'text';
|
|
32
|
+
text: string;
|
|
33
|
+
}>;
|
|
34
|
+
}>;
|
|
35
|
+
//# sourceMappingURL=tracking.tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tracking.tools.d.ts","sourceRoot":"","sources":["../../src/tools/tracking.tools.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC;AAEzF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;GAyBzB,CAAC;AAQF,wBAAsB,kBAAkB,CACtC,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,CAO7D"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const trackingTools = [
|
|
3
|
+
{
|
|
4
|
+
name: 'dataverse_change_detection',
|
|
5
|
+
description: 'Detects new, modified, and deleted records since a previous sync using Dataverse change tracking (delta queries). On first call, pass deltaToken=null to get an initial snapshot and receive a token. On subsequent calls, pass the returned token to retrieve only changes since last sync. Change tracking must be enabled on the table in Dataverse settings. Returns newAndModified records, deleted record IDs, and the nextDeltaToken for the next call.',
|
|
6
|
+
inputSchema: {
|
|
7
|
+
type: 'object',
|
|
8
|
+
properties: {
|
|
9
|
+
entitySetName: {
|
|
10
|
+
type: 'string',
|
|
11
|
+
description: 'OData entity set name (e.g., "accounts")',
|
|
12
|
+
},
|
|
13
|
+
deltaToken: {
|
|
14
|
+
anyOf: [{ type: 'string' }, { type: 'null' }],
|
|
15
|
+
description: 'Delta token from a previous call, or null for the initial sync',
|
|
16
|
+
},
|
|
17
|
+
select: {
|
|
18
|
+
type: 'array',
|
|
19
|
+
items: { type: 'string' },
|
|
20
|
+
description: 'Columns to return (recommended to minimise payload)',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
required: ['entitySetName', 'deltaToken'],
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
];
|
|
27
|
+
const ChangeDetectionInput = z.object({
|
|
28
|
+
entitySetName: z.string().min(1),
|
|
29
|
+
deltaToken: z.string().nullable(),
|
|
30
|
+
select: z.array(z.string()).optional(),
|
|
31
|
+
});
|
|
32
|
+
export async function handleTrackingTool(name, args, client) {
|
|
33
|
+
if (name === 'dataverse_change_detection') {
|
|
34
|
+
const { entitySetName, deltaToken, select } = ChangeDetectionInput.parse(args);
|
|
35
|
+
const result = await client.getChangedRecords(entitySetName, deltaToken, select);
|
|
36
|
+
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
|
37
|
+
}
|
|
38
|
+
throw new Error(`Unknown tracking tool: ${name}`);
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=tracking.tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tracking.tools.js","sourceRoot":"","sources":["../../src/tools/tracking.tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B;QACE,IAAI,EAAE,4BAA4B;QAClC,WAAW,EACT,gcAAgc;QAClc,WAAW,EAAE;YACX,IAAI,EAAE,QAAiB;YACvB,UAAU,EAAE;gBACV,aAAa,EAAE;oBACb,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,0CAA0C;iBACxD;gBACD,UAAU,EAAE;oBACV,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oBAC7C,WAAW,EAAE,gEAAgE;iBAC9E;gBACD,MAAM,EAAE;oBACN,IAAI,EAAE,OAAO;oBACb,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;oBACzB,WAAW,EAAE,qDAAqD;iBACnE;aACF;YACD,QAAQ,EAAE,CAAC,eAAe,EAAE,YAAY,CAAC;SAC1C;KACF;CACF,CAAC;AAEF,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAChC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACjC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;CACvC,CAAC,CAAC;AAEH,MAAM,CAA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