@smartbear/mcp 0.43.0 → 0.45.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.
Files changed (35) hide show
  1. package/dist/bugsnag/client/api/Project.js +1 -1
  2. package/dist/bugsnag/client.js +14 -2
  3. package/dist/bugsnag/input-schemas.js +31 -13
  4. package/dist/bugsnag/tool/error/get-error.js +5 -4
  5. package/dist/bugsnag/tool/error/list-project-errors.js +7 -5
  6. package/dist/bugsnag/tool/error/update-error.js +7 -4
  7. package/dist/bugsnag/tool/event/get-event-details-from-dashboard-url.js +3 -2
  8. package/dist/bugsnag/tool/event/get-event.js +4 -0
  9. package/dist/bugsnag/tool/event/list-error-events.js +16 -4
  10. package/dist/bugsnag/tool/performance/get-span-group.js +1 -0
  11. package/dist/bugsnag/tool/performance/get-trace.js +13 -5
  12. package/dist/bugsnag/tool/performance/list-span-groups.js +7 -3
  13. package/dist/bugsnag/tool/performance/list-spans.js +5 -2
  14. package/dist/bugsnag/tool/performance/list-trace-fields.js +1 -1
  15. package/dist/bugsnag/tool/performance/set-network-endpoint-groupings.js +3 -2
  16. package/dist/bugsnag/tool/project/get-current-project.js +3 -3
  17. package/dist/bugsnag/tool/project/list-project-event-filters.js +3 -3
  18. package/dist/bugsnag/tool/project/list-projects.js +6 -3
  19. package/dist/bugsnag/tool/release/get-build.js +4 -1
  20. package/dist/bugsnag/tool/release/get-release.js +4 -1
  21. package/dist/bugsnag/tool/release/list-releases.js +5 -4
  22. package/dist/common/cache.js +21 -2
  23. package/dist/common/config-names.js +12 -0
  24. package/dist/common/info.js +2 -0
  25. package/dist/common/list-integrations.js +53 -0
  26. package/dist/common/server.js +65 -3
  27. package/dist/common/transport-http.js +206 -35
  28. package/dist/common/transport-stdio.js +1 -6
  29. package/dist/package.json.js +1 -1
  30. package/dist/zephyr/common/rest-api-schemas.js +12 -3
  31. package/dist/zephyr/tool/test-case/create-web-link.js +17 -2
  32. package/dist/zephyr/tool/test-case/get-test-cases.js +9 -0
  33. package/dist/zephyr/tool/test-cycle/create-web-link.js +18 -2
  34. package/package.json +3 -1
  35. package/src/pactflow/drift/README.md +91 -0
@@ -144,7 +144,7 @@ class ProjectAPI extends BaseAPI {
144
144
  async listBuildsInRelease(releaseId) {
145
145
  const localVarFetchArgs = ProjectsApiFetchParamCreator(
146
146
  this.configuration
147
- ).getReleaseGroup(releaseId);
147
+ ).listReleaseGroupReleases(releaseId);
148
148
  return await this.requestArray(
149
149
  localVarFetchArgs.url,
150
150
  localVarFetchArgs.options,
@@ -2,7 +2,7 @@ import { createHmac } from "node:crypto";
2
2
  import { z } from "zod";
3
3
  import { CacheService } from "../common/cache.js";
4
4
  import { getUserAgent } from "../common/info.js";
5
- import { getRequestHeader } from "../common/request-context.js";
5
+ import { getRequestContext, getRequestHeader } from "../common/request-context.js";
6
6
  import { ToolError } from "../common/tools.js";
7
7
  import { CurrentUserAPI } from "./client/api/CurrentUser.js";
8
8
  import { Configuration } from "./client/api/configuration.js";
@@ -138,9 +138,21 @@ class BugsnagClient {
138
138
  config.endpoint
139
139
  );
140
140
  this._projectApiKey = config.project_api_key;
141
- this._authToken = config.auth_token;
141
+ this._authToken = this.isOperatorToken(config.auth_token) ? config.auth_token : void 0;
142
142
  await this.initializeApis(config);
143
143
  }
144
+ // A session identifier is not a credential, so a token a caller presented while
145
+ // opening an HTTP session must not outlive that request. Only a process-level
146
+ // token (stdio, or the operator's env var) may serve later requests.
147
+ isOperatorToken(token) {
148
+ if (!token) {
149
+ return false;
150
+ }
151
+ if (!getRequestContext()) {
152
+ return true;
153
+ }
154
+ return token === process.env.BUGSNAG_AUTH_TOKEN;
155
+ }
144
156
  getProjectApiKey() {
145
157
  const contextHeader = getRequestHeader("Bugsnag-Project-Api-Key");
146
158
  const requestProjectApiKey = Array.isArray(contextHeader) ? contextHeader[0] : contextHeader;
@@ -1,40 +1,58 @@
1
1
  import { z } from "zod";
2
2
  const filterValueSchema = z.object({
3
- type: z.enum(["eq", "ne", "empty"]),
4
- value: z.union([z.string(), z.boolean(), z.number()])
3
+ type: z.enum(["eq", "ne", "empty"]).describe(
4
+ "Comparison: 'eq' equals, 'ne' not equals, 'empty' matches when the field has no value (set 'value' to true, or false to match non-empty)"
5
+ ),
6
+ value: z.union([z.string(), z.boolean(), z.number()]).describe("Value to compare with")
5
7
  });
6
8
  const filtersSchema = z.record(z.string(), z.array(filterValueSchema));
7
9
  const toolInputParameters = {
8
10
  empty: z.object({}).describe("No parameters are required for this tool"),
9
- buildId: z.string().describe("Unique identifier of the app build"),
10
- errorId: z.string().describe("Unique identifier of the error"),
11
- eventId: z.string().describe("Unique identifier of the event"),
11
+ buildId: z.string().describe(
12
+ "ID of the app build. Get it from the 'builds' list returned by Get Release."
13
+ ),
14
+ errorId: z.string().describe(
15
+ "ID of the error (a group of similar events). Get it from List Project Errors."
16
+ ),
17
+ eventId: z.string().describe(
18
+ "ID of a single event (one occurrence of an error). Get it from Get Events on an Error, or from the 'event_id' parameter of a dashboard URL."
19
+ ),
12
20
  projectId: z.string().optional().describe(
13
- "Unique identifier of the project. This is optional if a current project is set and is used to set the current project for BugSnag tools."
21
+ "The BugSnag project ID: an opaque 24-character hex string such as '515fb9337c1074f6fd000003'. This is NOT the project name or slug (the 'my-project' part of a dashboard URL). Get it from the 'id' field returned by List Projects. Optional if a current project is configured (see Get Current Project). When no project is configured, the project provided here becomes the current project for subsequent calls."
14
22
  ),
15
- releaseId: z.string().describe("Unique identifier of the app release"),
16
- direction: z.enum(["asc", "desc"]).describe("Sort direction for ordering results").default("desc"),
23
+ releaseId: z.string().describe("ID of the release (release group). Get it from List Releases."),
24
+ direction: z.enum(["asc", "desc"]).describe(
25
+ "Sort direction: 'desc' (default) returns the highest/newest values first, 'asc' the lowest/oldest first"
26
+ ).default("desc"),
17
27
  performanceFilters: filtersSchema.describe(
18
- "Apply filters to narrow down the span group list. Use the List Trace Fields tool to discover available filter fields. Time filters support extended ISO 8601 format (e.g. 2018-05-20T00:00:00Z) or relative format (e.g. 7d, 24h)."
28
+ "Filters for spans, as an object keyed by field name, where each value is an array of { type: 'eq' | 'ne' | 'empty', value }. Multiple filters are combined with AND. Use the List Trace Fields tool to discover available filter fields. Time filters support extended ISO 8601 format (e.g. 2018-05-20T00:00:00Z) or relative format (e.g. 7d, 24h). If omitted this defaults to span.since=7d, so older spans are excluded - pass 'span.since' (e.g. 30d) to look further back."
19
29
  ).default({
20
30
  "span.since": [{ type: "eq", value: "7d" }]
21
31
  }),
22
32
  filters: filtersSchema.describe(
23
- "Apply filters to narrow down the error list. Use the List Project Event Filters tool to discover available filter fields. Time filters support extended ISO 8601 format (e.g. 2018-05-20T00:00:00Z) or relative format (e.g. 7d, 24h)."
33
+ "Filters on event fields, as an object keyed by field name, where each value is an array of { type: 'eq' | 'ne' | 'empty', value }. Multiple filters are combined with AND. Use the List Project Event Filters tool to discover available filter fields. Time filters (event.since, event.before) support extended ISO 8601 format (e.g. 2018-05-20T00:00:00Z) or relative format (e.g. 7d, 24h). If omitted this defaults to event.since=30d and error.status=open, so older events and errors that are not open are excluded. Any filter you do not specify keeps its default, so pass 'event.since' to look further back or 'error.status' to include other statuses."
24
34
  ).default({
25
35
  "event.since": [{ type: "eq", value: "30d" }],
26
36
  "error.status": [{ type: "eq", value: "open" }]
27
37
  }),
38
+ // For tools that already target a single, specific error: no implicit time or status restriction.
39
+ errorScopedFilters: filtersSchema.describe(
40
+ "Optional filters on event fields, as an object keyed by field name, where each value is an array of { type: 'eq' | 'ne' | 'empty', value }. Multiple filters are combined with AND. Use the List Project Event Filters tool to discover available filter fields. Time filters (event.since, event.before) support extended ISO 8601 format (e.g. 2018-05-20T00:00:00Z) or relative format (e.g. 7d, 24h). No filters are applied by default, so events of any age are included."
41
+ ).default({}),
28
42
  nextUrl: z.string().describe(
29
43
  "URL for retrieving the next page of results. Use the value in the previous response to get the next page when more results are available. Only values provided in the output from this tool can be used. Do not attempt to construct it manually."
30
44
  ).optional(),
31
45
  page: z.number().describe("Page number to return (starts from 1)").default(1),
32
46
  perPage: z.number().describe("How many results to return per page.").min(1).max(100).default(30),
33
47
  releaseStage: z.string().describe(
34
- "Filter releases by this stage (e.g. production, staging), defaults to 'production'"
48
+ "Only include releases from this release stage (e.g. production, staging, development). Defaults to 'production'"
35
49
  ).default("production"),
36
- sort: z.enum(["first_seen", "last_seen", "events", "users", "unsorted"]).describe("Field to sort the errors by").default("last_seen"),
37
- spanGroupId: z.string().describe("ID of the span group")
50
+ sort: z.enum(["first_seen", "last_seen", "events", "users", "unsorted"]).describe(
51
+ "Field to sort errors by: 'last_seen' (default), 'first_seen', 'events' (number of events), 'users' (number of users affected) or 'unsorted'"
52
+ ).default("last_seen"),
53
+ spanGroupId: z.string().describe(
54
+ "ID of the span group, e.g. '[HttpClient]GET-api.example.com'. Get it from List Span Groups and pass it as returned (do not URL-encode it)."
55
+ )
38
56
  };
39
57
  export {
40
58
  toolInputParameters
@@ -7,15 +7,15 @@ const inputSchema = z.object({
7
7
  errorId: toolInputParameters.errorId.describe(
8
8
  "Unique identifier of the error to retrieve"
9
9
  ),
10
- filters: toolInputParameters.filters.describe(
11
- "Apply filters to narrow down the error list. Use the List Project Event Filters tool to discover available filter fields. Time filters support extended ISO 8601 format (e.g. 2018-05-20T00:00:00Z) or relative format (e.g. 7d, 24h)."
10
+ filters: toolInputParameters.errorScopedFilters.describe(
11
+ "Optional filters that restrict which events of this error are used for the latest event and the pivot summaries, as an object keyed by field name where each value is an array of { type: 'eq' | 'ne' | 'empty', value }. Use the List Project Event Filters tool to discover available filter fields. Time filters (event.since, event.before) support extended ISO 8601 format (e.g. 2018-05-20T00:00:00Z) or relative format (e.g. 7d, 24h). No filters are applied by default, so events of any age are considered."
12
12
  )
13
13
  });
14
14
  class GetError extends Tool {
15
15
  specification = {
16
16
  title: "Get Error",
17
17
  toolset: "Errors",
18
- summary: "Get full details on an error, including aggregated and summarized data across all events (occurrences) and details of the latest event (occurrence), such as breadcrumbs, metadata and the stacktrace. Use the filters parameter to narrow down the summaries further.",
18
+ summary: "Get full details on an error: aggregated data across its events (occurrences), the latest event (with stacktrace, breadcrumbs and metadata) and pivot summaries. Use the filters parameter to restrict which events are considered.",
19
19
  purpose: "Retrieve all the information required on a specified error to understand who it is affecting and why.",
20
20
  useCases: [
21
21
  "Investigate a specific error found through the List Project Errors tool",
@@ -38,7 +38,8 @@ class GetError extends Tool {
38
38
  "Error IDs can be found using the List Project Errors tool",
39
39
  "Use this after filtering errors to get detailed information about specific errors",
40
40
  "Use Get Event Details tool if you need detailed information about a specific event (occurrence) rather than the aggregated error",
41
- "If you used a filter to get this error, you can pass the same filters here to restrict the results or apply further filters",
41
+ "If you used filters to find this error, you can pass the same filters here to restrict the latest event and pivots to the same events",
42
+ "To list more than the latest event, use the Get Events on an Error tool",
42
43
  "The URL provided in the response points should be shown to the user in all cases as it allows them to view the error in the dashboard and perform further analysis"
43
44
  ]
44
45
  };
@@ -4,7 +4,7 @@ import { toolInputParameters } from "../../input-schemas.js";
4
4
  const inputSchema = z.object({
5
5
  projectId: toolInputParameters.projectId,
6
6
  filters: toolInputParameters.filters.describe(
7
- "Apply filters to narrow down the error list. Use the List Project Event Filters tool to discover available filter fields. Time filters support extended ISO 8601 format (e.g. 2018-05-20T00:00:00Z) or relative format (e.g. 7d, 24h)."
7
+ "Filters that narrow down the error list, as an object keyed by field name where each value is an array of { type: 'eq' | 'ne' | 'empty', value }. Multiple filters are combined with AND. Use the List Project Event Filters tool to discover available filter fields. Time filters (event.since, event.before) support extended ISO 8601 format (e.g. 2018-05-20T00:00:00Z) or relative format (e.g. 7d, 24h). Defaults: 'event.since' is 30d and 'error.status' is 'open' unless you specify them, so errors that are fixed, ignored or snoozed, or have no events in the last 30 days, are excluded by default."
8
8
  ),
9
9
  sort: toolInputParameters.sort,
10
10
  direction: toolInputParameters.direction,
@@ -33,7 +33,7 @@ class ListProjectErrors extends Tool {
33
33
  "event.since": [{ type: "eq", value: "24h" }]
34
34
  }
35
35
  },
36
- expectedOutput: "JSON object with a list of errors in the 'data' field, a count of the current page of results in the 'count' field, and a total count of all results in the 'total' field"
36
+ expectedOutput: "JSON object with a list of errors in the 'data' field, a count of the current page of results in the 'data_count' field, and a total count of all results in the 'total_count' field"
37
37
  },
38
38
  {
39
39
  description: "Get the 10 open errors with the most users affected in the last 30 days",
@@ -46,7 +46,7 @@ class ListProjectErrors extends Tool {
46
46
  direction: "desc",
47
47
  perPage: 10
48
48
  },
49
- expectedOutput: "JSON object with a list of errors in the 'data' field, a count of the current page of results in the 'count' field, and a total count of all results in the 'total' field"
49
+ expectedOutput: "JSON object with a list of errors in the 'data' field, a count of the current page of results in the 'data_count' field, and a total count of all results in the 'total_count' field"
50
50
  },
51
51
  {
52
52
  description: "Get the next 50 results",
@@ -62,9 +62,11 @@ class ListProjectErrors extends Tool {
62
62
  "Combine multiple filters to narrow results - filters are applied with AND logic",
63
63
  "For time filters: use relative format (7d, 24h) for recent periods or ISO 8601 UTC format (2018-05-20T00:00:00Z) for specific dates",
64
64
  "Common time filters: event.since (from this time), event.before (until this time)",
65
- "The 'event.since' filter and 'error.status' filters are always applied and if not specified are set to '30d' and 'open' respectively",
65
+ "The 'event.since' filter and 'error.status' filters are always applied and if not specified are set to '30d' and 'open' respectively. To see errors that are fixed, ignored or snoozed, or older errors, set these filters explicitly (e.g. 'event.since' of '365d')",
66
+ "If no errors are returned, the default 30d/open filters may be excluding them - try widening 'event.since' or changing 'error.status' before concluding there are none",
67
+ "Use the 'id' of an error with Get Error or Get Events on an Error to investigate it further",
66
68
  "There may not be any errors matching the filters - this is not a problem with the tool, in fact it might be a good thing that the user's application had no errors",
67
- "This tool returns paged results. The 'page_error_count' field indicates the number of results returned in the current page, and the 'total_error_count' field indicates the total number of results across all pages.",
69
+ "This tool returns paged results. The 'data_count' field indicates the number of results returned in the current page, and the 'total_count' field indicates the total number of results across all pages.",
68
70
  "If the output contains a 'next_url' value, there are more results available - call this tool again supplying the next URL as a parameter to retrieve the next page.",
69
71
  "Do not modify the next URL as this can cause incorrect results. The only other parameter that can be used with 'next' is 'per_page' to control the page size."
70
72
  ]
@@ -22,9 +22,11 @@ const PERMITTED_REOPEN_CONDITIONS = [
22
22
  const inputSchema = z.object({
23
23
  projectId: toolInputParameters.projectId,
24
24
  errorId: toolInputParameters.errorId,
25
- operation: z.enum(PERMITTED_UPDATE_OPERATIONS).describe("The operation to apply to the error"),
25
+ operation: z.enum(PERMITTED_UPDATE_OPERATIONS).describe(
26
+ "The operation to apply: 'open' reopens the error; 'fix' marks it fixed; 'ignore' ignores it until manually reopened; 'snooze' ignores it until the condition in reopenRules is met; 'discard' stops storing new events for it and 'undiscard' resumes; 'override_severity' changes its severity (the user will be asked to choose the value); 'link_issue' links it to an external issue (requires issue_url) and 'unlink_issue' removes that link"
27
+ ),
26
28
  issue_url: z.string().optional().describe(
27
- "The URL of the issue to link to the error - required when operation is 'link_issue'"
29
+ "The URL of the issue (e.g. a Jira issue) to link to the error - required when operation is 'link_issue'"
28
30
  ),
29
31
  reopenRules: z.object({
30
32
  reopenIf: z.enum(PERMITTED_REOPEN_CONDITIONS).describe("Condition for when the error should be reopened"),
@@ -41,7 +43,7 @@ const inputSchema = z.object({
41
43
  "for n_occurrences_in_m_hours reopen rules, the number of hours."
42
44
  ),
43
45
  additionalOccurrences: z.number().min(1).optional().describe(
44
- "or n_additional_occurrences reopen rules, the number of additional occurrences allowed before reopening."
46
+ "for n_additional_occurrences reopen rules, the number of additional occurrences allowed before reopening."
45
47
  )
46
48
  }).optional().describe(
47
49
  "Reopen rules for snooze operation - required when operation is 'snooze'"
@@ -134,7 +136,8 @@ class UpdateError extends Tool {
134
136
  "For 'n_additional_users' reopen rules, specify 'additionalUsers' parameter (max 100,000)",
135
137
  "For 'n_occurrences_in_m_hours' reopen rules, specify both 'occurrences' and 'hours' parameters",
136
138
  "For 'n_additional_occurrences' reopen rules, specify 'additionalOccurrences' parameter",
137
- "Snoozing temporarily silences an error until the specified reopen condition is met"
139
+ "Snoozing temporarily silences an error until the specified reopen condition is met",
140
+ "This changes the error's workflow state in the BugSnag dashboard for the whole team - confirm with the user before any state-changing operation, including snoozing, fixing, ignoring, discarding, reopening, severity changes or issue links"
138
141
  ],
139
142
  readOnly: false,
140
143
  idempotent: false
@@ -2,7 +2,7 @@ import { z } from "zod";
2
2
  import { Tool, ToolError } from "../../../common/tools.js";
3
3
  const inputSchema = z.object({
4
4
  link: z.string().describe(
5
- "Full URL to the event details page in the BugSnag dashboard (web interface), containing project slug and event_id parameter."
5
+ "Full URL of an event in the BugSnag dashboard (web interface), e.g. https://app.bugsnag.com/<org-slug>/<project-slug>/errors/<errorId>?event_id=<eventId>. It must contain the project slug in the path and the event_id query parameter."
6
6
  )
7
7
  });
8
8
  class GetEventDetailsFromDashboardUrl extends Tool {
@@ -28,7 +28,8 @@ class GetEventDetailsFromDashboardUrl extends Tool {
28
28
  ],
29
29
  hints: [
30
30
  "The URL must contain both project slug in the path and event_id in query parameters",
31
- "This is useful when users share BugSnag dashboard URLs and you need to extract the event data"
31
+ "This is useful when users share BugSnag dashboard URLs and you need to extract the event data",
32
+ "The project slug in the URL is resolved to a project for you - you do not need to look up the project ID first"
32
33
  ]
33
34
  };
34
35
  handle = async (args, _ctx) => {
@@ -23,6 +23,10 @@ class GetEvent extends Tool {
23
23
  },
24
24
  expectedOutput: "JSON object with complete event details including stack trace (error trace and other threads, if present), metadata, and context"
25
25
  }
26
+ ],
27
+ hints: [
28
+ "Event IDs can be found using the Get Events on an Error tool, or in the 'event_id' parameter of a dashboard URL",
29
+ "If you only have a dashboard URL, use the Get Event Details From Dashboard URL tool instead"
26
30
  ]
27
31
  };
28
32
  handle = async (args, _ctx) => {
@@ -4,9 +4,7 @@ import { toolInputParameters } from "../../input-schemas.js";
4
4
  const inputSchema = z.object({
5
5
  projectId: toolInputParameters.projectId,
6
6
  errorId: toolInputParameters.errorId,
7
- filters: toolInputParameters.filters.describe(
8
- "Apply filters to narrow down the event list. Use the List Project Event Filters tool to discover available filter fields. Time filters support extended ISO 8601 format (e.g. 2018-05-20T00:00:00Z) or relative format (e.g. 7d, 24h)."
9
- ),
7
+ filters: toolInputParameters.errorScopedFilters,
10
8
  direction: toolInputParameters.direction,
11
9
  perPage: toolInputParameters.perPage,
12
10
  nextUrl: toolInputParameters.nextUrl
@@ -15,7 +13,7 @@ class ListErrorEvents extends Tool {
15
13
  specification = {
16
14
  title: "Get Events on an Error",
17
15
  toolset: "Events",
18
- summary: "Gets a list of events that have grouped into the specified error",
16
+ summary: "List the individual events (occurrences) of one error, newest first by default",
19
17
  purpose: "Show the events that make up an error to see individual occurrences of the error for detailed analysis",
20
18
  useCases: [
21
19
  "Retrieving all the events for comparison to find commonalities or differences in stack traces, breadcrumbs and metadata"
@@ -29,7 +27,21 @@ class ListErrorEvents extends Tool {
29
27
  errorId: "6863e2af012caf1d5c320000"
30
28
  },
31
29
  expectedOutput: "A list of events, ordered by timestamp, with complete details including stack trace, breadcrumbs, metadata, and context"
30
+ },
31
+ {
32
+ description: "Get events of an error from the last 7 days only",
33
+ parameters: {
34
+ errorId: "6863e2af012caf1d5c320000",
35
+ filters: { "event.since": [{ type: "eq", value: "7d" }] }
36
+ },
37
+ expectedOutput: "A list of events that occurred in the last 7 days"
32
38
  }
39
+ ],
40
+ hints: [
41
+ "No time filter is applied by default, so events of any age are returned. Use 'event.since' / 'event.before' in filters to restrict the time range",
42
+ "Event stack traces and metadata are included, so keep perPage small when you only need a few events",
43
+ "Use the 'id' of an event with the Get Event tool if you need to look at one event on its own",
44
+ "This tool returns paged results - if the output contains a 'next_url' value, call this tool again with it as the nextUrl parameter to get more events"
33
45
  ]
34
46
  };
35
47
  handle = async (args, _ctx) => {
@@ -37,6 +37,7 @@ class GetSpanGroup extends Tool {
37
37
  ],
38
38
  hints: [
39
39
  "Use List Span Groups first to discover available span group IDs",
40
+ "Statistics only cover the filtered time window (last 7 days by default) - pass span.since in filters to change it",
40
41
  "IDs are automatically URL-encoded - provide the raw ID",
41
42
  "Statistics include p50, p75, p90, p95, p99 percentiles"
42
43
  ]
@@ -3,10 +3,18 @@ import { Tool, ToolError } from "../../../common/tools.js";
3
3
  import { toolInputParameters } from "../../input-schemas.js";
4
4
  const inputSchema = z.object({
5
5
  projectId: toolInputParameters.projectId,
6
- traceId: z.string().describe("Trace ID"),
7
- from: z.string().describe("Start time (ISO 8601 format)"),
8
- to: z.string().describe("End time (ISO 8601 format)"),
9
- targetSpanId: z.string().optional().describe("Optional target span ID to focus on"),
6
+ traceId: z.string().describe(
7
+ "ID of the trace, from the trace ID of a span returned by List Spans"
8
+ ),
9
+ from: z.string().describe(
10
+ "Start of the time window to search, ISO 8601 UTC (e.g. 2024-01-01T00:00:00Z). Must be before the time the trace occurred"
11
+ ),
12
+ to: z.string().describe(
13
+ "End of the time window to search, ISO 8601 UTC. Must be after the time the trace occurred - use the span timestamp plus a few minutes"
14
+ ),
15
+ targetSpanId: z.string().optional().describe(
16
+ "Optional ID of a span in the trace; results are focused around this span"
17
+ ),
10
18
  perPage: toolInputParameters.perPage,
11
19
  nextUrl: toolInputParameters.nextUrl
12
20
  });
@@ -46,7 +54,7 @@ class GetTrace extends Tool {
46
54
  ],
47
55
  hints: [
48
56
  "Traces show the complete execution path of a request",
49
- "Use from/to parameters to narrow the time window",
57
+ "The from/to window must contain the trace - take the timestamp of a span from List Spans and use a window around it",
50
58
  "targetSpanId can be used to focus on a specific span in the trace"
51
59
  ]
52
60
  };
@@ -33,10 +33,14 @@ const inputSchema = z.object({
33
33
  "rendering_metrics_fps_mean_p99",
34
34
  "http_response_4xx_percentage",
35
35
  "http_response_5xx_percentage"
36
- ]).optional().describe("Field to sort by"),
36
+ ]).optional().describe(
37
+ "Field to sort by, e.g. duration_p95 or duration_p99 for the slowest operations, total_spans for the most frequently used, last_seen for the most recent"
38
+ ),
37
39
  direction: toolInputParameters.direction,
38
40
  perPage: toolInputParameters.perPage,
39
- starredOnly: z.boolean().optional().describe("Show only starred span groups"),
41
+ starredOnly: z.boolean().optional().describe(
42
+ "If true, only include span groups that have been starred as important in the dashboard"
43
+ ),
40
44
  nextUrl: toolInputParameters.nextUrl,
41
45
  filters: toolInputParameters.performanceFilters
42
46
  });
@@ -76,7 +80,7 @@ class ListSpanGroups extends Tool {
76
80
  hints: [
77
81
  "Span groups represent different operation types (page loads, API calls, etc.)",
78
82
  "Use sort by duration_p95 or duration_p99 to find the slowest operations",
79
- "Star important span groups for quick access",
83
+ "Only span groups with spans in the filtered time window are returned (last 7 days by default) - pass span.since in filters to look further back",
80
84
  "Use nextUrl for pagination"
81
85
  ]
82
86
  };
@@ -20,7 +20,9 @@ const inputSchema = z.object({
20
20
  "rendering_metrics_fps_minimum",
21
21
  "rendering_metrics_fps_maximum",
22
22
  "http_response_code"
23
- ]).optional().describe("Field to sort by"),
23
+ ]).optional().describe(
24
+ "Field to sort by, e.g. duration for the slowest spans or timestamp for the newest"
25
+ ),
24
26
  direction: toolInputParameters.direction,
25
27
  perPage: toolInputParameters.perPage,
26
28
  nextUrl: toolInputParameters.nextUrl,
@@ -64,7 +66,8 @@ class ListSpans extends Tool {
64
66
  ],
65
67
  hints: [
66
68
  "Sort by duration descending to find the slowest instances",
67
- "Each span includes trace ID for further investigation"
69
+ "Each span includes trace ID for further investigation with the Get Trace tool",
70
+ "Only spans from the filtered time window are returned (last 7 days by default) - pass span.since in filters to look further back"
68
71
  ]
69
72
  };
70
73
  handle = async (args, _ctx) => {
@@ -25,7 +25,7 @@ class ListTraceFields extends Tool {
25
25
  ],
26
26
  hints: [
27
27
  "Trace fields are custom attributes added to spans",
28
- "Use these fields for filtering other performance queries"
28
+ "Use these field names as keys in the filters parameter of List Span Groups, Get Span Group and List Spans"
29
29
  ]
30
30
  };
31
31
  handle = async (args, _ctx) => {
@@ -55,11 +55,12 @@ class SetNetworkEndpointGroupings extends Tool {
55
55
  }
56
56
  ],
57
57
  hints: [
58
- "Use Get Network Grouping first to see current patterns",
58
+ "Use Get Network Endpoint Groupings first to see current patterns",
59
59
  "Use OpenAPI path templating with curly braces for path parameters: /users/{userId}, /orders/{orderId}/items/{itemId}",
60
60
  "Convert colon-prefixed parameters to curly braces: :organizationSlug becomes {organizationSlug}, :projectSlug becomes {projectSlug}",
61
61
  "Wildcards (*) can be used in domains to match subdomains: https://*.example.com/api",
62
- "This replaces all existing patterns - include all patterns you want to keep",
62
+ "This REPLACES all existing patterns - call Get Network Endpoint Groupings first and send back the full list with your changes, otherwise existing patterns are lost",
63
+ "Confirm with the user before calling this tool, as it changes the endpoint grouping configuration for the whole project",
63
64
  "Well-designed patterns reduce noise in performance monitoring"
64
65
  ],
65
66
  readOnly: false,
@@ -11,15 +11,15 @@ class GetCurrentProject extends Tool {
11
11
  hints: [
12
12
  "If a project is returned, it can be assumed that the user expects interactions with BugSnag tools to refer to this project",
13
13
  "If this tool returns no current project then other BugSnag tools will require an explicit project ID parameter",
14
- "Call the List Projects tool to see all projects that the user has access to. Get the project ID from this list either by asking the user for the project name or slug",
15
- "You might find a BugSnag API key in the user's code where they configure the BugSnag SDK that can be matched to a project 'apiKey' field from the project list"
14
+ "Call the List Projects tool to see all projects that the user has access to. Find the project in this list by the name or slug the user gives you, then use its 'id' field (not the name or slug) as the projectId parameter",
15
+ "You might find a BugSnag API key in the user's code where they configure the BugSnag SDK that can be matched to a project's 'api_key' field from the project list"
16
16
  ]
17
17
  };
18
18
  handle = async (_args, _ctx) => {
19
19
  const project = await this.client.getCurrentProject();
20
20
  if (!project) {
21
21
  throw new ToolError(
22
- "No current project is configured in the MCP server - use List Projects to see the available projects and use the project ID as a parameter to other BugSnag tools. You can ask the user to select the project based on the name or slug, or use the apiKey field and see if there's a BugSnag API key set in the user's code when they configure the BugSnag SDK"
22
+ "No current project is configured in the MCP server - use List Projects to see the available projects and use the project ID as a parameter to other BugSnag tools. You can ask the user to select the project by name or slug and then use that project's 'id' from the list as projectId, or use the apiKey field and see if there's a BugSnag API key set in the user's code when they configure the BugSnag SDK"
23
23
  );
24
24
  }
25
25
  return {
@@ -9,7 +9,7 @@ class ListProjectEventFilters extends Tool {
9
9
  title: "List Project Event Filters",
10
10
  toolset: "Projects",
11
11
  summary: "Get available event filter fields for a project",
12
- purpose: "Discover valid filter field names and options that can be used with the List Errors or Get Error tools",
12
+ purpose: "Discover the filter field names (including custom metadata fields) that are valid for this project, for use in the 'filters' parameter of List Project Errors, Get Error and Get Events on an Error",
13
13
  useCases: [
14
14
  "Discover what filter fields are available before searching for errors",
15
15
  "Find the correct field names for filtering by user, environment, or custom metadata",
@@ -24,8 +24,8 @@ class ListProjectEventFilters extends Tool {
24
24
  }
25
25
  ],
26
26
  hints: [
27
- "Use this tool before the List Errors or Get Error tools to understand available filters",
28
- "Look for display_id field in the response - these are the field names to use in filters"
27
+ "Use this tool before the List Project Errors, Get Error or Get Events on an Error tools to understand available filters",
28
+ "Look for display_id field in the response - these are the field names to use as keys in the filters parameter (e.g. 'error.status', 'event.since', 'user.email')"
29
29
  ]
30
30
  };
31
31
  handle = async (args, _ctx) => {
@@ -1,13 +1,15 @@
1
1
  import { z } from "zod";
2
2
  import { Tool, ToolError } from "../../../common/tools.js";
3
3
  const inputSchema = z.object({
4
- apiKey: z.string().optional().describe("The API key of the BugSnag project, if known.")
4
+ apiKey: z.string().optional().describe(
5
+ "The notifier API key of the BugSnag project (found where the BugSnag SDK is configured in the user's code). If provided, only the project with this key is returned."
6
+ )
5
7
  });
6
8
  class ListProjects extends Tool {
7
9
  specification = {
8
10
  toolset: "Projects",
9
11
  title: "List Projects",
10
- summary: "List all projects in the organization that the current user has access to, or find a project matching an API key.",
12
+ summary: "List the projects the current user has access to, or find the project matching an API key. Each project includes its 'id', 'name', 'slug' and 'api_key'.",
11
13
  purpose: "Retrieve available projects for browsing and selecting which project to analyze.",
12
14
  useCases: [
13
15
  "Get an overview of all projects in the organization",
@@ -15,7 +17,8 @@ class ListProjects extends Tool {
15
17
  ],
16
18
  inputSchema,
17
19
  hints: [
18
- "Project IDs from this list can be used with other tools when no project API key is configured"
20
+ "Use the 'id' field (not the name or slug) as the projectId parameter of other BugSnag tools when no current project is configured",
21
+ "To find a project the user refers to by name or slug, look it up in this list and use its 'id'"
19
22
  ]
20
23
  };
21
24
  handle = async (args, _ctx) => {
@@ -26,7 +26,10 @@ class GetBuild extends Tool {
26
26
  expectedOutput: "JSON object with build details including version, source control info, error counts and stability data."
27
27
  }
28
28
  ],
29
- hints: ["Build IDs can be found using the List builds tool"],
29
+ hints: [
30
+ "Build IDs can be found in the list of builds returned by the Get Release tool",
31
+ "user_stability and session_stability are fractions between 0 and 1; meets_target_stability and meets_critical_stability compare them with the project's stability targets"
32
+ ],
30
33
  readOnly: true,
31
34
  idempotent: true,
32
35
  outputDescription: "JSON object containing build details along with stability metrics such as user and session stability, and whether it meets project targets"
@@ -26,7 +26,10 @@ class GetRelease extends Tool {
26
26
  expectedOutput: "JSON object with release details including version, source control info, error counts and stability data."
27
27
  }
28
28
  ],
29
- hints: ["Release IDs can be found using the List releases tool"],
29
+ hints: [
30
+ "Release IDs can be found using the List Releases tool",
31
+ "user_stability and session_stability are fractions between 0 and 1; meets_target_stability and meets_critical_stability compare them with the project's stability targets"
32
+ ],
30
33
  readOnly: true,
31
34
  idempotent: true,
32
35
  outputDescription: "JSON object containing release details along with stability metrics such as user and session stability, and whether it meets project targets"
@@ -5,7 +5,7 @@ const inputSchema = z.object({
5
5
  projectId: toolInputParameters.projectId,
6
6
  releaseStage: toolInputParameters.releaseStage,
7
7
  visibleOnly: z.boolean().describe(
8
- "Whether to only include releases that are marked as visible in the dashboard"
8
+ "If true, excludes releases that have been hidden in the dashboard. Defaults to false (include all)"
9
9
  ).default(false),
10
10
  perPage: toolInputParameters.perPage,
11
11
  nextUrl: toolInputParameters.nextUrl
@@ -14,7 +14,7 @@ class ListReleases extends Tool {
14
14
  specification = {
15
15
  title: "List Releases",
16
16
  toolset: "Releases",
17
- summary: "List releases for a project",
17
+ summary: "List release groups (versions of the app) for a project, with stability metrics",
18
18
  purpose: "Retrieve a list of release summaries to analyze deployment history and associated errors",
19
19
  useCases: [
20
20
  "View recent releases to correlate with error spikes",
@@ -24,7 +24,7 @@ class ListReleases extends Tool {
24
24
  examples: [
25
25
  {
26
26
  description: "List production releases for a project",
27
- parameters: {},
27
+ parameters: { projectId: "515fb9337c1074f6fd000003" },
28
28
  expectedOutput: "JSON array of release objects in the production stage"
29
29
  },
30
30
  {
@@ -43,7 +43,8 @@ class ListReleases extends Tool {
43
43
  }
44
44
  ],
45
45
  hints: [
46
- "Use the Get Release tool to get more details on a specific release, including the builds it contains",
46
+ "Use the Get Release tool with a release's id to get more details, including the builds it contains",
47
+ "Only the production stage is listed by default - set releaseStage to list releases from another stage",
47
48
  "The release stage defaults to 'production' if not specified",
48
49
  "Use visibleOnly to filter out releases that have been marked as hidden in the dashboard"
49
50
  ],
@@ -10,11 +10,23 @@ function isCachingEnabled() {
10
10
  class CacheService {
11
11
  cache;
12
12
  enabled;
13
- constructor() {
13
+ /**
14
+ * @param options.sweepExpired Run node-cache's periodic expiry sweep
15
+ * (default true). The sweep re-arms a timer forever, and that pending timer
16
+ * keeps the cache - and everything in it - reachable until `close()` is
17
+ * called. Short-lived owners (one cache per server instance, which can mean
18
+ * one per request) must pass false so the cache can be garbage collected
19
+ * along with its owner; expired entries are still dropped lazily on `get`.
20
+ * Only process-lifetime singletons should leave the sweep on.
21
+ */
22
+ constructor(options = {}) {
14
23
  this.enabled = isCachingEnabled();
15
24
  const ttl = getConfiguredCacheTtlSeconds();
16
25
  this.cache = this.enabled ? new NodeCache({
17
- stdTTL: ttl
26
+ stdTTL: ttl,
27
+ // Only set when disabling: an explicit `undefined` would override
28
+ // node-cache's default sweep period rather than fall back to it.
29
+ ...options.sweepExpired === false ? { checkperiod: 0 } : {}
18
30
  }) : null;
19
31
  }
20
32
  /**
@@ -51,6 +63,13 @@ class CacheService {
51
63
  isEnabled() {
52
64
  return this.enabled;
53
65
  }
66
+ /**
67
+ * Stop the expiry sweep timer and drop all entries.
68
+ */
69
+ close() {
70
+ this.cache?.flushAll();
71
+ this.cache?.close();
72
+ }
54
73
  /**
55
74
  * Clear all cache entries
56
75
  */
@@ -0,0 +1,12 @@
1
+ function getEnvVarName(clientPrefix, key) {
2
+ return `${clientPrefix.toUpperCase().replace(/-/g, "_")}_${key.toUpperCase()}`;
3
+ }
4
+ function getHeaderName(clientPrefix, key) {
5
+ return `${clientPrefix}-${key.split("_").map(
6
+ (part) => part.charAt(0).toUpperCase() + part.slice(1).toLowerCase()
7
+ ).join("-")}`;
8
+ }
9
+ export {
10
+ getEnvVarName,
11
+ getHeaderName
12
+ };