@tenonhq/dovetail-servicenow 0.0.15 → 0.0.17

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.
@@ -8,6 +8,7 @@
8
8
  */
9
9
  import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
10
10
  import { z } from "zod";
11
+ import type { ToolAnnotations } from "@tenonhq/dovetail-mcp-kit";
11
12
  import type { ServiceNowClient } from "../client";
12
13
  export declare var TOOL_NAMES: readonly ["create_view", "set_list_layout", "set_form_layout", "set_related_lists", "add_choices_to_field", "flow_view", "action_view", "flow_publish", "flow_copy", "flow_create", "flow_test", "flow_edit"];
13
14
  export type ToolName = typeof TOOL_NAMES[number];
@@ -19,6 +20,7 @@ export interface ToolDescriptor {
19
20
  name: ToolName;
20
21
  description: string;
21
22
  shape: z.ZodRawShape;
23
+ annotations: ToolAnnotations;
22
24
  handler: (args: any) => Promise<any>;
23
25
  }
24
26
  export declare function buildDescriptors(deps?: RegistryDeps): Array<ToolDescriptor>;
@@ -11,6 +11,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
11
11
  exports.TOOL_NAMES = void 0;
12
12
  exports.buildDescriptors = buildDescriptors;
13
13
  exports.registerAllTools = registerAllTools;
14
+ const dovetail_mcp_kit_1 = require("@tenonhq/dovetail-mcp-kit");
14
15
  const client_1 = require("../client");
15
16
  const views_1 = require("../layout/views");
16
17
  const listLayout_1 = require("../layout/listLayout");
@@ -39,6 +40,9 @@ exports.TOOL_NAMES = [
39
40
  "flow_test",
40
41
  "flow_edit"
41
42
  ];
43
+ // Annotation presets (READ_ONLY / WRITE_ADDITIVE_IDEMPOTENT / WRITE_CREATE /
44
+ // WRITE_OVERWRITE / WRITE_EXECUTE) come from @tenonhq/dovetail-mcp-kit.
45
+ // openWorldHint is left at its spec default (true) — every tool reaches a ServiceNow instance.
42
46
  function buildDescriptors(deps = {}) {
43
47
  function client() {
44
48
  return deps.client || (0, client_1.createClient)({});
@@ -46,6 +50,7 @@ function buildDescriptors(deps = {}) {
46
50
  return [
47
51
  {
48
52
  name: "create_view",
53
+ annotations: dovetail_mcp_kit_1.WRITE_ADDITIVE_IDEMPOTENT,
49
54
  description: "Create a ServiceNow custom view (sys_ui_view). Idempotent — an existing view of the "
50
55
  + "same name is returned unchanged. Every write is captured in the supplied update set.",
51
56
  shape: schemas_1.createViewSchema.shape,
@@ -55,6 +60,7 @@ function buildDescriptors(deps = {}) {
55
60
  },
56
61
  {
57
62
  name: "set_list_layout",
63
+ annotations: dovetail_mcp_kit_1.WRITE_OVERWRITE,
58
64
  description: "Declaratively set a ServiceNow list layout — which columns appear in a list, and their "
59
65
  + "order — for a table + view. Idempotent; prune (default true) removes columns not in "
60
66
  + "the spec; dryRun previews without writing. Writes are captured in the update set.",
@@ -65,6 +71,7 @@ function buildDescriptors(deps = {}) {
65
71
  },
66
72
  {
67
73
  name: "set_form_layout",
74
+ annotations: dovetail_mcp_kit_1.WRITE_OVERWRITE,
68
75
  description: "Declaratively set a ServiceNow form layout — sections and the fields within them — for "
69
76
  + "a table + view. The first section is the primary section (omit its caption). "
70
77
  + "Idempotent; prune (default true) removes sections/fields not in the spec; dryRun "
@@ -76,6 +83,7 @@ function buildDescriptors(deps = {}) {
76
83
  },
77
84
  {
78
85
  name: "set_related_lists",
86
+ annotations: dovetail_mcp_kit_1.WRITE_OVERWRITE,
79
87
  description: "Declaratively set which related lists appear on a ServiceNow form for a table + view. "
80
88
  + "Related-list ids are \"<table>.<field>\" or \"REL:<sys_relationship>\". Idempotent; "
81
89
  + "prune (default true); dryRun previews. Writes are captured in the update set.",
@@ -86,6 +94,7 @@ function buildDescriptors(deps = {}) {
86
94
  },
87
95
  {
88
96
  name: "add_choices_to_field",
97
+ annotations: dovetail_mcp_kit_1.WRITE_ADDITIVE_IDEMPOTENT,
89
98
  description: "Upsert sys_choice values for a ServiceNow table.column and (optionally) flip "
90
99
  + "sys_dictionary.choice so the field renders as a dropdown. Idempotent. Writes are "
91
100
  + "captured in the supplied update set.",
@@ -96,6 +105,7 @@ function buildDescriptors(deps = {}) {
96
105
  },
97
106
  {
98
107
  name: "flow_view",
108
+ annotations: dovetail_mcp_kit_1.READ_ONLY,
99
109
  description: "Read a ServiceNow Flow Designer flow or subflow's compiled step graph, headless. "
100
110
  + "Returns the ordered, nesting-aware list of action + flow-logic steps plus the flow "
101
111
  + "variables, via GET /api/now/processflow/flow/{sysId}. Read-only. Pass raw:true to "
@@ -108,6 +118,7 @@ function buildDescriptors(deps = {}) {
108
118
  },
109
119
  {
110
120
  name: "action_view",
121
+ annotations: dovetail_mcp_kit_1.READ_ONLY,
111
122
  description: "Read a ServiceNow Custom Action Type's compiled model (identity, inputs, outputs), "
112
123
  + "headless, via GET /api/now/processflow/action/action_types/{sysId}. Read-only. "
113
124
  + "sysId is the sys_hub_action_type_definition sys_id; scopeSysId is the application "
@@ -120,6 +131,7 @@ function buildDescriptors(deps = {}) {
120
131
  },
121
132
  {
122
133
  name: "flow_publish",
134
+ annotations: dovetail_mcp_kit_1.WRITE_OVERWRITE,
123
135
  description: "Publish (compile the snapshot of) a ServiceNow Flow Designer flow or subflow via "
124
136
  + "POST /api/now/processflow/flow/{sysId}/snapshot. This is a WRITE that recompiles the "
125
137
  + "flow's current design — use after editing in the Designer. sysId is the sys_hub_flow "
@@ -132,6 +144,7 @@ function buildDescriptors(deps = {}) {
132
144
  },
133
145
  {
134
146
  name: "flow_copy",
147
+ annotations: dovetail_mcp_kit_1.WRITE_CREATE,
135
148
  description: "Copy a ServiceNow flow/subflow via the Designer's Copy endpoint — a complete, faithful "
136
149
  + "clone created as an INACTIVE DRAFT in the target scope. sourceSysId is the sys_hub_flow "
137
150
  + "to copy; newName is the copy's name; scopeSysId defaults to the source's scope. Publish "
@@ -145,6 +158,7 @@ function buildDescriptors(deps = {}) {
145
158
  },
146
159
  {
147
160
  name: "flow_create",
161
+ annotations: dovetail_mcp_kit_1.WRITE_CREATE,
148
162
  description: "Create a NEW ServiceNow Flow Designer flow (sys_hub_flow, type=flow) from scratch and "
149
163
  + "PUBLISH it, headless. Mints a fresh flow via POST /processflow/flow, grafts the trigger + "
150
164
  + "action graph from an existing published template flow (templateSysId), then compiles the "
@@ -174,6 +188,7 @@ function buildDescriptors(deps = {}) {
174
188
  },
175
189
  {
176
190
  name: "flow_test",
191
+ annotations: dovetail_mcp_kit_1.WRITE_EXECUTE,
177
192
  description: "Test or run a ServiceNow flow/subflow. mode='validate' (default) is a safe, read-only "
178
193
  + "pre-flight — checks the flow is published and that supplied inputs match its declared "
179
194
  + "variables; it never runs the flow. mode='execute' actually runs it via the server-side "
@@ -194,6 +209,7 @@ function buildDescriptors(deps = {}) {
194
209
  },
195
210
  {
196
211
  name: "flow_edit",
212
+ annotations: dovetail_mcp_kit_1.WRITE_OVERWRITE,
197
213
  description: "Edit a ServiceNow flow/subflow in place. Supports rename (name/internalName), description, "
198
214
  + "and patchStepInputs (set named input values on steps by uiId or label). apply=false "
199
215
  + "(default) is a dry-run that returns the diff; apply=true persists the edit (a write). "
@@ -215,25 +231,7 @@ function buildDescriptors(deps = {}) {
215
231
  ];
216
232
  }
217
233
  function registerAllTools(server, deps = {}) {
218
- var descriptors = buildDescriptors(deps);
219
- for (var i = 0; i < descriptors.length; i += 1) {
220
- registerOne(server, descriptors[i]);
221
- }
222
- }
223
- function registerOne(server, desc) {
224
- server.registerTool(desc.name, { description: desc.description, inputSchema: desc.shape }, async function (args) {
225
- try {
226
- var result = await desc.handler(args);
227
- return { content: [{ type: "text", text: JSON.stringify(result) }] };
228
- }
229
- catch (err) {
230
- var message = err instanceof Error ? err.message : String(err);
231
- return {
232
- isError: true,
233
- content: [
234
- { type: "text", text: JSON.stringify({ error: message, tool: desc.name }) }
235
- ]
236
- };
237
- }
238
- });
234
+ // registerKitTools owns serialization + the { error, retryable, tool } contract.
235
+ // No telemetry recorder is injected here (telemetry parity is a P2 follow-on).
236
+ (0, dovetail_mcp_kit_1.registerKitTools)(server, buildDescriptors(deps));
239
237
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tenonhq/dovetail-servicenow",
3
- "version": "0.0.15",
3
+ "version": "0.0.17",
4
4
  "engines": {
5
5
  "node": ">=22"
6
6
  },
@@ -19,6 +19,7 @@
19
19
  "license": "GPL-3.0",
20
20
  "dependencies": {
21
21
  "@modelcontextprotocol/sdk": "^1.29.0",
22
+ "@tenonhq/dovetail-mcp-kit": "~0.0.1",
22
23
  "axios": "^1.5.1",
23
24
  "dotenv": "^16.3.1",
24
25
  "zod": "^3.23.0"