ras_site_get_notifications
Retrieve notification event configuration including alert triggers, email settings, and thresholds to verify admin alerting is properly configured.
Instructions
Get notification event configuration, including alert triggers, email notifications, and event thresholds. Use this to review which events trigger admin notifications or verify alerting is properly configured.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/site-settings.ts:176-195 (registration)Tool registration for ras_site_get_notifications with schema definition, title, description, annotations, and input schema configuration using server.registerToolserver.registerTool( "ras_site_get_notifications", { title: "Notification Events", description: "Get notification event configuration, including alert triggers, email " + "notifications, and event thresholds. Use this to review which events " + "trigger admin notifications or verify alerting is properly configured.", annotations: READ_ONLY_ANNOTATIONS, inputSchema: {}, }, async () => { try { const data = await rasClient.get("/api/site-settings/notifications/events"); return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] }; } catch (err) { return { content: [{ type: "text" as const, text: sanitiseError(err, "Failed to retrieve notification events") }], isError: true }; } } );
- src/tools/site-settings.ts:187-194 (handler)Handler function that executes the tool logic: makes a GET request to /api/site-settings/notifications/events API endpoint and returns formatted JSON data or sanitized error messageasync () => { try { const data = await rasClient.get("/api/site-settings/notifications/events"); return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] }; } catch (err) { return { content: [{ type: "text" as const, text: sanitiseError(err, "Failed to retrieve notification events") }], isError: true }; } }
- src/tools/site-settings.ts:12-17 (schema)READ_ONLY_ANNOTATIONS constant providing metadata annotations for the tool (readOnlyHint, destructiveHint, idempotentHint, openWorldHint)const READ_ONLY_ANNOTATIONS = { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true, } as const;
- src/client.ts:128-166 (helper)RasClient.get method used by the handler to make authenticated GET requests to the RAS API with automatic token refresh and error handlingasync get(path: string): Promise<unknown> { // Ensure we have a valid session if (!this.authToken) { await this.login(); } const fetchOptions = { method: "GET" as const, headers: { ...this.headers, auth_token: this.authToken!, }, signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS), }; let response = await fetch(`${this.baseUrl}${path}`, fetchOptions); // Token may have expired — re-authenticate once and retry if (response.status === 401) { await this.login(); response = await fetch(`${this.baseUrl}${path}`, { ...fetchOptions, headers: { ...this.headers, auth_token: this.authToken!, }, signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS), }); } if (!response.ok) { const body = await response.text(); throw new Error( `RAS API error (HTTP ${response.status}) on ${path}: ${body.substring(0, 300)}` ); } return response.json(); }
- src/client.ts:43-54 (helper)sanitiseError function used to sanitize error messages by removing sensitive tokens/passwords and truncating long responsesfunction sanitiseError(err: unknown, context: string): string { const raw = err instanceof Error ? err.message : String(err); // Remove anything that looks like a token or password value let sanitised = raw .replace(/auth_token[=:]\s*\S+/gi, "auth_token=[REDACTED]") .replace(/password[=:]\s*\S+/gi, "password=[REDACTED]"); // Truncate excessively long API response bodies if (sanitised.length > 500) { sanitised = sanitised.substring(0, 500) + "... (truncated)"; } return `${context}: ${sanitised}`; }