@jupiterone/jupiterone-mcp 0.0.4 → 0.0.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.
Files changed (63) hide show
  1. package/README.md +2 -2
  2. package/dist/client/graphql/mutations.js +13 -10
  3. package/dist/client/graphql/mutations.js.map +1 -1
  4. package/dist/client/graphql/queries.js +17 -14
  5. package/dist/client/graphql/queries.js.map +1 -1
  6. package/dist/client/jupiterone-client.d.ts +6 -3
  7. package/dist/client/jupiterone-client.d.ts.map +1 -1
  8. package/dist/client/jupiterone-client.js +35 -20
  9. package/dist/client/jupiterone-client.js.map +1 -1
  10. package/dist/client/services/account-service.d.ts +1 -0
  11. package/dist/client/services/account-service.d.ts.map +1 -1
  12. package/dist/client/services/account-service.js +9 -4
  13. package/dist/client/services/account-service.js.map +1 -1
  14. package/dist/client/services/alert-service.js +7 -3
  15. package/dist/client/services/alert-service.js.map +1 -1
  16. package/dist/client/services/dashboard-service.d.ts +4 -0
  17. package/dist/client/services/dashboard-service.d.ts.map +1 -1
  18. package/dist/client/services/dashboard-service.js +21 -8
  19. package/dist/client/services/dashboard-service.js.map +1 -1
  20. package/dist/client/services/integration-service.js +11 -7
  21. package/dist/client/services/integration-service.js.map +1 -1
  22. package/dist/client/services/j1ql-service.js +9 -5
  23. package/dist/client/services/j1ql-service.js.map +1 -1
  24. package/dist/client/services/rule-service.d.ts +4 -0
  25. package/dist/client/services/rule-service.d.ts.map +1 -1
  26. package/dist/client/services/rule-service.js +26 -13
  27. package/dist/client/services/rule-service.js.map +1 -1
  28. package/dist/generated/description-map.d.ts +2 -0
  29. package/dist/generated/description-map.d.ts.map +1 -0
  30. package/dist/generated/description-map.js +2300 -0
  31. package/dist/generated/description-map.js.map +1 -0
  32. package/dist/index.js +11 -12
  33. package/dist/index.js.map +1 -1
  34. package/dist/server/mcp-server.d.ts +4 -1
  35. package/dist/server/mcp-server.d.ts.map +1 -1
  36. package/dist/server/mcp-server.js +1535 -1366
  37. package/dist/server/mcp-server.js.map +1 -1
  38. package/dist/types/jupiterone.d.ts +3 -2
  39. package/dist/types/jupiterone.d.ts.map +1 -1
  40. package/dist/types/jupiterone.js +2 -1
  41. package/dist/utils/description-loader.js +8 -5
  42. package/dist/utils/description-loader.js.map +1 -1
  43. package/dist/utils/getEnv.d.ts +2 -0
  44. package/dist/utils/getEnv.d.ts.map +1 -0
  45. package/dist/utils/getEnv.js +16 -0
  46. package/dist/utils/getEnv.js.map +1 -0
  47. package/dist/utils/j1ql-validator.js +5 -1
  48. package/dist/utils/j1ql-validator.js.map +1 -1
  49. package/dist/utils/load-description.d.ts.map +1 -1
  50. package/dist/utils/load-description.js +7 -7
  51. package/dist/utils/load-description.js.map +1 -1
  52. package/package.json +5 -5
  53. package/dist/descriptions/create-dashboard-widget.md +0 -325
  54. package/dist/descriptions/create-dashboard.md +0 -12
  55. package/dist/descriptions/create-inline-question-rule.md +0 -374
  56. package/dist/descriptions/create-j1ql-from-natural-language.md +0 -7
  57. package/dist/descriptions/execute-j1ql-query.md +0 -379
  58. package/dist/descriptions/get-integration-definitions.md +0 -27
  59. package/dist/descriptions/get-integration-instances.md +0 -35
  60. package/dist/descriptions/list-alerts.md +0 -14
  61. package/dist/descriptions/list-rules.md +0 -53
  62. package/dist/descriptions/update-dashboard.md +0 -467
  63. package/dist/descriptions/update-inline-question-rule.md +0 -363
@@ -1,325 +0,0 @@
1
- # JupiterOne Create Dashboard Widget Tool
2
-
3
- **Purpose**: Adds a new widget to a specified JupiterOne dashboard. This tool allows you to programmatically create visual widgets (such as pie charts, bar charts, tables, etc.) on any dashboard, using custom queries and configuration.
4
-
5
- This tool should be used when:
6
- - You want to add a new visualization to an existing dashboard
7
- - You need to automate dashboard widget creation for reporting or monitoring
8
- - You want to programmatically manage dashboard content
9
-
10
- ## Required Parameters
11
- - `dashboardId`: The ID of the dashboard to add the widget to
12
- - `input`: The widget configuration object (CreateInsightsWidgetInput), including:
13
- - `title`: Widget title
14
- - `description`: Widget description (optional)
15
- - `type`: Widget type (e.g., 'pie', 'bar', 'table', etc.)
16
- - `noResultMessage`: Message to display when there are no results
17
- - `config`: Widget configuration, including queries and settings
18
-
19
- ## Supported Chart Types
20
-
21
- The following values are supported for the `type` property when creating a widget:
22
-
23
- ```typescript
24
- export enum ChartType {
25
- Area = 'area',
26
- Bar = 'bar',
27
- Graph = 'graph',
28
- Line = 'line',
29
- Matrix = 'matrix',
30
- Number = 'number',
31
- Pie = 'pie',
32
- Table = 'table',
33
- Status = 'status',
34
- Markdown = 'markdown',
35
- }
36
- ```
37
-
38
- ## Example Usage
39
- ```json
40
- {
41
- "dashboardId": "95936c1a-468a-494f-b11d-b134ac9b9577",
42
- "input": {
43
- "title": "Example title",
44
- "type": "pie",
45
- "noResultMessage": "Message that shows when no results",
46
- "config": {
47
- "queries": [
48
- {
49
- "query": "FIND (aws_db_cluster_snapshot|aws_db_snapshot) as snapshot\n RETURN\n snapshot.tag.AccountName as name,\n sum(snapshot.allocatedStorage) * 0.02 as value",
50
- "name": "Query 1"
51
- }
52
- ],
53
- "settings": {
54
- "pie": {
55
- "customColors": {
56
- "0": "#26A69A",
57
- "1": "#3F51B5",
58
- "2": "#D81B60",
59
- "3": "#FF8F00",
60
- "4": "#9575CD",
61
- "5": "#8BC34A",
62
- "6": "#039BE5"
63
- },
64
- "upwardTrendIsGood": true
65
- }
66
- }
67
- }
68
- }
69
- }
70
- ```
71
-
72
- # Widget Options
73
-
74
- When creating a dashboard, there are several options for widgets to choose from. This allows you to utilize the most impactful visual representation for your data. Below are the supported dashboard widgets, each with their own requirements and examples.
75
-
76
- ---
77
-
78
- # Chart Types and Example Queries
79
-
80
- > **Note:**
81
- > To enable trend functionality for a chart, set `trendDataIsEnabled: true` in the relevant chart type's settings (e.g., `settings.pie.trendDataIsEnabled`). You can also use keys like `trendQueryResultsCount` to control the number of trend data points, and `upwardTrendIsGood` to indicate if an upward trend is positive.
82
-
83
- ## Number
84
- The number chart visualization shows one large stat value. In the trend version of this chart you are able to track the value through a spark line to see if the result is getting larger or smaller over time.
85
-
86
- ### Query Requirements
87
- Expects only a single `value` in the returned query response.
88
-
89
- ### Example Queries
90
- **Trend:**
91
- ```j1ql
92
- FIND User AS u
93
- RETURN count(u) AS value
94
- ```
95
- **Non-Trend:**
96
- ```j1ql
97
- FIND User AS u
98
- RETURN count(u) AS value
99
- ```
100
-
101
- ---
102
-
103
- ## Pie Chart
104
- The pie chart displays values from one or more queries, as they relate to each other, in the form of slices of a pie. The arc length, area and central angle of a slice are all proportional to the slice's value, as it relates to the sum of all values. This type of chart is best used when you want a quick comparison of a small set of values in an aesthetically pleasing form. In the trend version of this chart you are able to track the value change of each slice value as well as the total value through a spark line to see if the data set is getting larger or smaller over time.
105
-
106
- ### Query Requirements
107
- Expects 2 or more pairs of `name` and numeric `value` properties.
108
-
109
- ### Example Queries
110
- **Trend:**
111
- ```j1ql
112
- FIND DataStore AS ds
113
- THAT RELATES TO (Account|Service) AS a
114
- RETURN
115
- a.tag.AccountName AS name,
116
- count(ds) AS value
117
- ```
118
- **Non-Trend 1:**
119
- ```j1ql
120
- FIND DataStore AS ds
121
- THAT RELATES TO (Account|Service) AS a
122
- RETURN
123
- a.tag.AccountName AS name,
124
- count(ds) AS value
125
- ```
126
- **Non-Trend 2:**
127
- ```j1ql
128
- FIND DataStore AS ds
129
- THAT RELATES TO (Account|Service) AS a
130
- RETURN
131
- count(ds) AS value
132
- ```
133
-
134
- ---
135
-
136
- ## Bar Chart
137
- The bar chart visualization allows you to view categorical data to analyze your queries with a specified x and y axis. You are able to run multiple queries and visualize the bar chart in stacked format. This chart is best suited for categorizing your results. In the trend version of the chart you are able to visualize the value change of each categorical result through a %Change indicator and a reference category bar of the result value from the previous time period selected.
138
-
139
- ### Query Requirements
140
- Expects one or more `x` and `y` values.
141
-
142
- ### Example Queries
143
- **Trend:**
144
- ```j1ql
145
- FIND Person AS p
146
- THAT IS User AS u
147
- THAT opened PR
148
- WITH state='OPEN' AS pr
149
- RETURN
150
- p.displayName AS x,
151
- count(pr) AS y
152
- ORDER BY y DESC
153
- ```
154
- **Non-Trend:**
155
- ```j1ql
156
- FIND Person AS p
157
- THAT IS User AS u
158
- THAT opened PR
159
- WITH state='OPEN' AS pr
160
- RETURN
161
- p.displayName AS x,
162
- count(pr) AS y
163
- ORDER BY y DESC
164
- LIMIT 5
165
- ```
166
-
167
- ---
168
-
169
- ## Line Chart
170
- The line chart is created by plotting a series of several points and connecting them with a straight line. This is best suited for data that has historical trend data enabled.
171
-
172
- ### Query Requirements
173
- Expects `line` and `y` values.
174
-
175
- ### Example Queries
176
- **Trend:**
177
- ```j1ql
178
- FIND Finding
179
- WITH createdOn > date.now-7day AS f
180
- RETURN
181
- count(f) AS y,
182
- f.numericSeverity AS line
183
- ```
184
- **Non-Trend:**
185
- ```j1ql
186
- FIND Finding
187
- WITH createdOn > date.now-7day AS f
188
- RETURN
189
- f.createdOn AS x,
190
- count(f) AS y,
191
- f.numericSeverity AS line
192
- ```
193
-
194
- ---
195
-
196
- ## Matrix Chart
197
- The matrix chart is used for analyzing and displaying the relationship between data sets. The matrix diagram shows the relationship between two, three, or four groups of information.
198
-
199
- ### Query Requirements
200
- Expects `x` and `y` row and column names. Optional `label` to be shown in each cell. Any additional properties returned will be shown as key: value.
201
-
202
- ### Example Queries
203
- **Firewall matrix:**
204
- ```j1ql
205
- FIND Firewall AS row
206
- THAT allows AS rel
207
- Network AS col
208
- RETURN
209
- row.displayName AS x,
210
- col.displayName AS y,
211
- rel.egress AS egress,
212
- rel.ingress AS ingress,
213
- rel.fromPort as fromPort,
214
- rel.toPort as toPort,
215
- rel.ipProtocol AS label
216
- ```
217
-
218
- ---
219
-
220
- ## Table
221
- The tables chart present data in as close to raw form as possible. Tables are meant to be read, so they are ideal when you have data that cannot easily be presented visually, or when the data requires more specific attention.
222
-
223
- ### Query Requirements
224
- Note: This chart is currently limited to displaying 250 rows, and it does not handle pagination. It is recommended to use LIMIT and ORDER BY to sort and limit the results.
225
-
226
- ### Example Queries
227
- **Most recent people:**
228
- ```j1ql
229
- FIND Person AS p
230
- RETURN
231
- p.name AS Name,
232
- p.email AS Email,
233
- p.manager AS Manager
234
- ORDER BY p._createdOn DESC
235
- LIMIT 5
236
- ```
237
-
238
- ---
239
-
240
- ## Graph Chart
241
- The graph chart displays a tree graph of query results. This chart is best used to visualize specific relationships between entities.
242
-
243
- ### Example Queries
244
- **Most recent people:**
245
- ```j1ql
246
- FIND Person RETURN TREE
247
- ```
248
-
249
- ---
250
-
251
- ## Status
252
- The status chart displays a visual summary of correlating queries. This chart is best used to show positive or negative results based on if relationships are present in query results. This chart is best suited by multiple queries.
253
-
254
- ### Example Queries
255
- **Users passing security check:**
256
- ```j1ql
257
- Find Person as p
258
- Return
259
- p.email as id,
260
- p.name as displayName,
261
- p.acceptedSecurityPolicyOn,
262
- p.backgroundCheck,
263
- p.iconWebLink as iconWebLink
264
- ```
265
- ```j1ql
266
- Find Person as p that owns Device as d
267
- Return
268
- p.email as id,
269
- d.encrypted
270
- ```
271
- ```j1ql
272
- Find Person as p that is User as u
273
- Return
274
- p.email as id,
275
- count(u)
276
- ```
277
-
278
- ---
279
-
280
- ## Area Chart
281
- The area chart is a graph that combines a line chart and a bar chart to show changes in quantities over time. This chart requires the assets in the query to have relevant dates in their properties. For the best results, these charts can be generated by J1 Questions that have trend collection enabled. (This will soon be available straight from Insights.)
282
-
283
- ### Query Requirements
284
- Expects two or more `x` and `y` values.
285
-
286
- ### Example Queries
287
- **Top 5 most open PRs by Person:**
288
- ```j1ql
289
- FIND Person AS p
290
- THAT IS User AS u
291
- THAT opened PR
292
- WITH state='OPEN' AS pr
293
- RETURN
294
- p.displayName AS x,
295
- count(pr) AS y
296
- ORDER BY y DESC
297
- LIMIT 5
298
- ```
299
-
300
- ---
301
-
302
- ## Markdown Chart
303
- The markdown chart/widget allows you to display custom Markdown content directly on your dashboard. This is useful for adding documentation, instructions, or contextual information alongside your visualizations.
304
-
305
- ### Query Requirements
306
- - No queries are required for this widget type.
307
- - The widget's settings must include a `markdown.text` property containing the Markdown content to display.
308
-
309
- ### Example Configuration
310
- **Simple Markdown widget:**
311
- ```json
312
- {
313
- "type": "markdown",
314
- "config": {
315
- "queries": [],
316
- "settings": {
317
- "markdown": {
318
- "text": "# test markdown here\nsome more content"
319
- }
320
- }
321
- }
322
- }
323
- ```
324
-
325
- ---
@@ -1,12 +0,0 @@
1
- # Create Dashboard Tool
2
-
3
- Creates a new dashboard in JupiterOne. This tool is simple and self-descriptive: provide a name and a type to create a dashboard. Unless specified otherwise, default to creating personal dashboards.
4
- After creating a dashboard and all its widgets, you will typically want to call `update-dashboard` tool to set a layout favorable for the user, widgets should never be left at their default size.
5
-
6
- ## Valid Dashboard Types
7
- ```typescript
8
- export enum DashboardType {
9
- USER = 'User',
10
- ACCOUNT = 'Account',
11
- }
12
- ```
@@ -1,374 +0,0 @@
1
- # JupiterOne Rule Creation Tool - Complete Guide
2
-
3
- **Purpose**: Creates inline question-based alert rules in JupiterOne to monitor entities and trigger alerts based on specified conditions.
4
-
5
- The first step in creating a rule is to identify the query you want to use in order to get the data you want to take action with. Use the `execute-j1ql-query` tool to find the correct query.
6
-
7
- ## Key Requirements for Success
8
-
9
- ### 1. Condition Format (Critical)
10
- The `condition` parameter must use JupiterOne's specific array format:
11
- - **Structure**: `["LOGICAL_OPERATOR", [left_value, operator, right_value]]`
12
- - **Example**: `["AND", ["queries.queryName.total", ">", 0]]`
13
- - **Supported operators**: `>`, `<`, `>=`, `<=`, `=`, `!=`
14
- - **Logical operators**: `"AND"`, `"OR"`
15
-
16
- ### 2. Operations Structure
17
- The `when` clause should only contain:
18
- - `type`: Always `"FILTER"`
19
- - `condition`: The array format described above
20
- - **Do NOT include**: `version`, `specVersion` (these belong at the rule level, not in the when clause)
21
-
22
- ### 3. Query Naming Convention
23
- - Query names in the `queries` array must match the references in conditions
24
- - Example: If query name is `"users"`, reference it as `"queries.users.total"`
25
- - **IMPORTANT**: Use `"query0"` as the standard query name for compatibility with existing patterns
26
-
27
- ### 4. New Entity Detection
28
- - Use `triggerActionsOnNewEntitiesOnly: true` to only alert on genuinely new entities
29
- - This prevents re-alerting on existing entities every polling cycle
30
- - Essential for "new user" or "new resource" type alerts
31
-
32
- ### 5. Polling Intervals
33
- - **Default**: Use `"ONE_DAY"` unless the user specifically requests a different interval
34
- - **Available options**: `"DISABLED"`, `"THIRTY_MINUTES"`, `"ONE_HOUR"`, `"FOUR_HOURS"`, `"EIGHT_HOURS"`, `"TWELVE_HOURS"`, `"ONE_DAY"`, `"ONE_WEEK"`
35
- - Only use more frequent intervals (like `"THIRTY_MINUTES"`) when explicitly requested or for time-sensitive security alerts
36
-
37
- ### 6. Tags vs Labels (Important)
38
- - **DEPRECATED**: The `tags` array field is deprecated and should always be set to an empty array `[]`
39
- - **USE INSTEAD**: For tagging functionality, use the `labels` field with key-value pairs
40
- - **Format**: `labels: [{"labelName": "key", "labelValue": "value"}]`
41
- - **When users ask for tagging**: Always use the `labels` field to meet their needs
42
- - **Note**: The `tags` field is still required in the schema for compatibility but should remain empty
43
-
44
- ## Required Schema Fields
45
-
46
- ### Complete Required Parameters for create-inline-question-rule
47
- **CRITICAL**: All of these fields must be included for successful rule creation:
48
-
49
- ```json
50
- {
51
- "name": "Rule Name",
52
- "description": "Rule description",
53
- "notifyOnFailure": true,
54
- "triggerActionsOnNewEntitiesOnly": true,
55
- "ignorePreviousResults": false,
56
- "pollingInterval": "ONE_DAY",
57
- "specVersion": 1,
58
- "templates": {},
59
- "outputs": ["alertLevel"],
60
- "tags": [],
61
- "labels": [
62
- {"labelName": "environment", "labelValue": "production"},
63
- {"labelName": "team", "labelValue": "security"}
64
- ],
65
- "queries": [
66
- {
67
- "query": "FIND Entity...",
68
- "name": "query0",
69
- "version": "v1",
70
- "includeDeleted": false
71
- }
72
- ],
73
- "operations": [
74
- {
75
- "when": {
76
- "type": "FILTER",
77
- "condition": ["AND", ["queries.query0.total", ">", 0]]
78
- },
79
- "actions": [...]
80
- }
81
- ]
82
- }
83
- ```
84
-
85
- **Key Schema Requirements**:
86
- - `ignorePreviousResults`: Must be included (typically `false`)
87
- - `templates`: Must be included (use `{}` if empty)
88
- - `tags`: Must be included but should always be empty `[]` (deprecated field)
89
- - `labels`: Use this for actual tagging functionality with key-value pairs
90
- - Query `name`: Use `"query0"` for primary query
91
- - Query `version`: Include `"v1"` for compatibility
92
- - Query `includeDeleted`: Must be explicitly set to `false`
93
-
94
- ## Available Action Types
95
-
96
- ### 1. SET_PROPERTY
97
- Sets a property value on the alert (commonly used for alert severity levels).
98
-
99
- **Configuration**:
100
- ```json
101
- {
102
- "type": "SET_PROPERTY",
103
- "targetProperty": "alertLevel",
104
- "targetValue": "CRITICAL"
105
- }
106
- ```
107
-
108
- **Common Values for alertLevel**: `"LOW"`, `"MEDIUM"`, `"HIGH"`, `"CRITICAL"`, `"INFO"`
109
-
110
- ### 2. CREATE_ALERT
111
- Creates a basic alert in JupiterOne.
112
-
113
- **Configuration**:
114
- ```json
115
- {
116
- "type": "CREATE_ALERT"
117
- }
118
- ```
119
-
120
- **Note**: This is the most basic action and should almost always be included.
121
-
122
- ### 3. SEND_EMAIL
123
- Sends email notifications to specified recipients.
124
-
125
- **Configuration**:
126
- ```json
127
- {
128
- "type": "SEND_EMAIL",
129
- "recipients": ["user1@company.com", "user2@company.com"],
130
- "body": "Affected Items: <br><br>* {{queries.query0.data|mapProperty('displayName')|join('<br>* ')}}"
131
- }
132
- ```
133
-
134
- **Required Information to Ask User**:
135
- - Email addresses of recipients
136
- - Custom email body content (if desired)
137
-
138
- **Template Variables Available**:
139
- - `{{alertWebLink}}` - Link to the alert in JupiterOne
140
- - `{{queries.queryName.data|mapProperty('fieldName')|join('separator')}}` - Format query results
141
-
142
- ### 4. TAG_ENTITIES
143
- Adds or removes tags from entities that triggered the rule.
144
-
145
- **Configuration**:
146
- ```json
147
- {
148
- "type": "TAG_ENTITIES",
149
- "entities": "{{queries.query0.data}}",
150
- "tags": [
151
- {"name": "existing tag to remove", "value": null},
152
- {"name": "new tag", "value": "tag value"}
153
- ]
154
- }
155
- ```
156
-
157
- **Required Information to Ask User**:
158
- - Tag names and values to add
159
- - Tag names to remove (set value to `null`)
160
-
161
- ### 5. SEND_SLACK_MESSAGE
162
- Sends messages to Slack channels (requires Slack integration).
163
-
164
- **Configuration**:
165
- ```json
166
- {
167
- "integrationInstanceId": "d97d9127-c532-410a-bf0a-9ea93f66c3d2",
168
- "type": "SEND_SLACK_MESSAGE",
169
- "channels": ["#security-alerts", "#general"],
170
- "body": "*Affected Items:* \n\n- {{queries.query0.data|mapProperty('displayName')|join('\n- ')}}"
171
- }
172
- ```
173
-
174
- **Required Information to Ask User**:
175
- - Slack channel names (with # prefix)
176
- - Slack integration instance ID (may need to query available integrations)
177
- - Custom message content (if desired)
178
-
179
- ### 6. SEND_TO_S3
180
- Sends alert data to an S3 bucket (requires AWS S3 integration).
181
-
182
- **Configuration**:
183
- ```json
184
- {
185
- "integrationInstanceId": "f89568b4-2a1b-4bd8-8abd-aee21270df75",
186
- "type": "SEND_TO_S3",
187
- "bucket": "security-alerts-bucket",
188
- "region": "us-east-1",
189
- "data": {
190
- "description": "{{alertWebLink}}\n\n**Affected Items:**\n\n* {{queries.query0.data|mapProperty('displayName')|join('\n* ')}}"
191
- }
192
- }
193
- ```
194
-
195
- **Required Information to Ask User**:
196
- - S3 bucket name
197
- - AWS region
198
- - S3 integration instance ID
199
- - Data structure to send
200
-
201
- ### 7. CREATE_JIRA_TICKET
202
- Creates a Jira ticket for the alert (requires Jira integration).
203
-
204
- **Configuration**:
205
- ```json
206
- {
207
- "integrationInstanceId": "53a99eaa-18a5-45ef-b748-2de39d642a91",
208
- "type": "CREATE_JIRA_TICKET",
209
- "entityClass": "Finding",
210
- "summary": "Security Alert: Critical Unencrypted Data Found",
211
- "issueType": "Bug",
212
- "project": "SEC",
213
- "updateContentOnChanges": false,
214
- "additionalFields": {
215
- "description": {
216
- "type": "doc",
217
- "version": 1,
218
- "content": [
219
- {
220
- "type": "paragraph",
221
- "content": [
222
- {
223
- "type": "text",
224
- "text": "{{alertWebLink}}\n\n**Affected Items:**\n\n* {{queries.query0.data|mapProperty('displayName')|join('\n* ')}}"
225
- }
226
- ]
227
- }
228
- ]
229
- }
230
- }
231
- }
232
- ```
233
-
234
- **Required Information to Ask User**:
235
- - Jira project key
236
- - Issue type (Bug, Task, Story, etc.)
237
- - Ticket summary/title
238
- - Jira integration instance ID
239
- - Additional fields as needed
240
-
241
- **Common Entity Classes**: `"Finding"`, `"Incident"`, `"Issue"`
242
-
243
- ## Template Variables and Formatting
244
-
245
- ### Available Variables
246
- - `{{alertWebLink}}` - Direct link to the alert in JupiterOne
247
- - `{{queries.queryName.data}}` - Array of entities from the specified query
248
- - `{{queries.queryName.total}}` - Count of entities from the query
249
-
250
- ### Data Formatting
251
- - `|mapProperty('fieldName')` - Extract specific field from each entity
252
- - `|join('separator')` - Join array elements with specified separator
253
- - Example: `{{queries.users.data|mapProperty('displayName')|join(', ')}}` - Creates comma-separated list of user names
254
-
255
- ### Common Formatting Patterns
256
- - **HTML list**: `{{queries.query0.data|mapProperty('displayName')|join('<br>* ')}}`
257
- - **Markdown list**: `{{queries.query0.data|mapProperty('displayName')|join('\n- ')}}`
258
- - **Simple list**: `{{queries.query0.data|mapProperty('displayName')|join('\n* ')}}`
259
-
260
- ## Integration Dependencies
261
-
262
- For actions requiring integrations, you may need to:
263
- 1. Query available integration instances using `get-integration-instances`
264
- 2. Ask the user which integration to use
265
- 3. Use the integration's `id` as the `integrationInstanceId`
266
-
267
- **Actions requiring integrations**:
268
- - `SEND_SLACK_MESSAGE` (Slack integration)
269
- - `SEND_TO_S3` (AWS S3 integration)
270
- - `CREATE_JIRA_TICKET` (Jira integration)
271
-
272
- ## Working Example Template
273
-
274
- ### Complete Working Rule Structure
275
- Based on confirmed working examples, use this template:
276
-
277
- ```json
278
- {
279
- "name": "Your Rule Name",
280
- "description": "Your rule description",
281
- "notifyOnFailure": true,
282
- "triggerActionsOnNewEntitiesOnly": true,
283
- "ignorePreviousResults": false,
284
- "pollingInterval": "ONE_DAY",
285
- "specVersion": 1,
286
- "templates": {},
287
- "outputs": ["alertLevel"],
288
- "tags": [],
289
- "labels": [
290
- {"labelName": "severity", "labelValue": "high"},
291
- {"labelName": "category", "labelValue": "security"}
292
- ],
293
- "queries": [
294
- {
295
- "query": "FIND Entity WITH condition",
296
- "name": "query0",
297
- "version": "v1",
298
- "includeDeleted": false
299
- }
300
- ],
301
- "operations": [
302
- {
303
- "when": {
304
- "type": "FILTER",
305
- "condition": ["AND", ["queries.query0.total", ">", 0]]
306
- },
307
- "actions": [
308
- {
309
- "type": "SET_PROPERTY",
310
- "targetProperty": "alertLevel",
311
- "targetValue": "CRITICAL"
312
- },
313
- {
314
- "type": "CREATE_ALERT"
315
- },
316
- {
317
- "type": "SEND_EMAIL",
318
- "recipients": ["user@company.com"],
319
- "body": "Affected Items: <br><br>* {{queries.query0.data|mapProperty('displayName')|join('<br>* ')}}"
320
- }
321
- ]
322
- }
323
- ]
324
- }
325
- ```
326
-
327
- ## Common Patterns
328
-
329
- ### New Entity Monitoring
330
- ```json
331
- {
332
- "condition": ["AND", ["queries.query0.total", ">", 0]],
333
- "triggerActionsOnNewEntitiesOnly": true
334
- }
335
- ```
336
-
337
- ### Threshold-based Alerts
338
- ```json
339
- {
340
- "condition": ["AND", ["queries.query0.total", ">=", 5]]
341
- }
342
- ```
343
-
344
- ### Multi-action Rule Example
345
- ```json
346
- "actions": [
347
- {"type": "SET_PROPERTY", "targetProperty": "alertLevel", "targetValue": "HIGH"},
348
- {"type": "CREATE_ALERT"},
349
- {"type": "SEND_EMAIL", "recipients": ["security@company.com"], "body": "Security issue detected: {{alertWebLink}}"},
350
- {"type": "TAG_ENTITIES", "entities": "{{queries.query0.data}}", "tags": [{"name": "needs-review", "value": "true"}]}
351
- ]
352
- ```
353
-
354
- ## Debugging Tips
355
- - If you get "Invalid conjunction operator" errors, check the condition array format
356
- - If you get "additional properties" errors, remove extra fields from the `when` clause
357
- - If you get missing property errors, ensure all required schema fields are included
358
- - **Always include**: `ignorePreviousResults`, `templates`, `tags`, query `version` and `includeDeleted`
359
- - Always reference existing rules with `get-rule-details` to see working examples
360
- - Test with simple conditions first, then add complexity
361
- - Use `"query0"` as the standard query name for compatibility
362
-
363
- ## Best Practices
364
- - Use descriptive query names that match their purpose (but prefer `"query0"` for main query)
365
- - Include relevant entity fields in `outputs` for alert context
366
- - Set appropriate polling intervals (default to `"ONE_DAY"` unless specified)
367
- - Use the `labels` field for rule organization and tagging (not the deprecated `tags` field)
368
- - Use `notifyOnFailure: true` to catch rule execution issues
369
- - Always include `CREATE_ALERT` action as a baseline
370
- - Always include all required schema fields from the working template
371
- - Ask users for specific details when configuring notification actions (emails, channels, etc.)
372
- - When users request tagging functionality, use the `labels` field with key-value pairs
373
-
374
- This format ensures reliable rule creation and helps avoid common pitfalls encountered during rule development.