Skip to content

Commit 324189e

Browse files
authored
feat(grafana): validate integration and add folder, health, and contact-point tools (#5082)
* feat(grafana): validate integration and add folder, health, and contact-point tools - Require alert-rule title/ruleGroup/data in the block (create would 400 without them) - Trim UID path params across dashboard and alert-rule tools to avoid copy-paste 404s - Use Grafana brand color for the block background - Surface previously-unsettable list params (limit, starred, annotation type) - Add get/update/delete folder, check data source health, get health, and create contact point tools - Strip non-TSDoc comments; regenerate docs and integrations.json * fix(grafana): scope block param remaps per operation to prevent cross-operation leaks
1 parent ed31edf commit 324189e

21 files changed

Lines changed: 1226 additions & 107 deletions

apps/docs/components/icons.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2936,12 +2936,11 @@ export function ClickHouseIcon(props: SVGProps<SVGSVGElement>) {
29362936

29372937
export function MicrosoftIcon(props: SVGProps<SVGSVGElement>) {
29382938
return (
2939-
<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 23 23' {...props}>
2940-
<path fill='#f3f3f3' d='M0 0h23v23H0z' />
2941-
<path fill='#f35325' d='M1 1h10v10H1z' />
2942-
<path fill='#81bc06' d='M12 1h10v10H12z' />
2943-
<path fill='#05a6f0' d='M1 12h10v10H1z' />
2944-
<path fill='#ffba08' d='M12 12h10v10H12z' />
2939+
<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 109 109' {...props}>
2940+
<polygon fill='#F1511B' points='51.9,51.9 0,51.9 0,0 51.9,0' />
2941+
<polygon fill='#80CC28' points='109.3,51.9 57.3,51.9 57.3,0 109.3,0' />
2942+
<polygon fill='#00ADEF' points='51.9,109.3 0,109.3 0,57.4 51.9,57.4' />
2943+
<polygon fill='#FBBC09' points='109.3,109.3 57.3,109.3 57.3,57.4 109.3,57.4' />
29452944
</svg>
29462945
)
29472946
}

apps/docs/content/docs/en/integrations/grafana.mdx

Lines changed: 157 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { BlockInfoCard } from "@/components/ui/block-info-card"
77

88
<BlockInfoCard
99
type="grafana"
10-
color="#FFFFFF"
10+
color="#F46800"
1111
/>
1212

1313
{/* MANUAL-CONTENT-START:intro */}
@@ -401,6 +401,34 @@ List all alert notification contact points
401401
|`disableResolveMessage` | boolean | Whether resolve messages are disabled |
402402
|`provenance` | string | Provisioning source \(empty if API-managed\) |
403403

404+
### `grafana_create_contact_point`
405+
406+
Create a notification contact point (e.g., Slack, email, PagerDuty)
407+
408+
#### Input
409+
410+
| Parameter | Type | Required | Description |
411+
| --------- | ---- | -------- | ----------- |
412+
| `apiKey` | string | Yes | Grafana Service Account Token |
413+
| `baseUrl` | string | Yes | Grafana instance URL \(e.g., https://your-grafana.com\) |
414+
| `organizationId` | string | No | Organization ID for multi-org Grafana instances \(e.g., 1, 2\) |
415+
| `name` | string | Yes | Name of the contact point \(groups receivers shown in the UI\) |
416+
| `type` | string | Yes | Receiver type \(e.g., slack, email, pagerduty, webhook\) |
417+
| `settings` | string | Yes | JSON object of type-specific settings \(e.g., \{"addresses":"a@b.com"\} for email, \{"url":"..."\} for slack\) |
418+
| `disableResolveMessage` | boolean | No | Do not send a notification when the alert resolves |
419+
| `disableProvenance` | boolean | No | Set X-Disable-Provenance header so the contact point remains editable in the UI |
420+
421+
#### Output
422+
423+
| Parameter | Type | Description |
424+
| --------- | ---- | ----------- |
425+
| `uid` | string | UID of the created contact point |
426+
| `name` | string | Name of the contact point |
427+
| `type` | string | Receiver type |
428+
| `settings` | json | Type-specific settings |
429+
| `disableResolveMessage` | boolean | Whether resolve notifications are suppressed |
430+
| `provenance` | string | Provisioning source \(empty if API-managed\) |
431+
404432
### `grafana_create_annotation`
405433

406434
Create an annotation on a dashboard or as a global annotation
@@ -584,6 +612,26 @@ Get a data source by its ID or UID
584612
| `version` | number | Data source version |
585613
| `readOnly` | boolean | Whether the data source is read-only |
586614

615+
### `grafana_check_data_source_health`
616+
617+
Test connectivity to a data source by its UID
618+
619+
#### Input
620+
621+
| Parameter | Type | Required | Description |
622+
| --------- | ---- | -------- | ----------- |
623+
| `apiKey` | string | Yes | Grafana Service Account Token |
624+
| `baseUrl` | string | Yes | Grafana instance URL \(e.g., https://your-grafana.com\) |
625+
| `organizationId` | string | No | Organization ID for multi-org Grafana instances \(e.g., 1, 2\) |
626+
| `dataSourceUid` | string | Yes | The UID of the data source to health-check \(e.g., P1234AB5678\) |
627+
628+
#### Output
629+
630+
| Parameter | Type | Description |
631+
| --------- | ---- | ----------- |
632+
| `status` | string | Health status of the data source \(e.g., OK\) |
633+
| `message` | string | Detailed health message from the data source |
634+
587635
### `grafana_list_folders`
588636

589637
List all folders in Grafana
@@ -655,4 +703,112 @@ Create a new folder in Grafana
655703
| `updated` | string | Timestamp when the folder was last updated |
656704
| `version` | number | Version number of the folder |
657705

706+
### `grafana_get_folder`
707+
708+
Get a folder by its UID
709+
710+
#### Input
711+
712+
| Parameter | Type | Required | Description |
713+
| --------- | ---- | -------- | ----------- |
714+
| `apiKey` | string | Yes | Grafana Service Account Token |
715+
| `baseUrl` | string | Yes | Grafana instance URL \(e.g., https://your-grafana.com\) |
716+
| `organizationId` | string | No | Organization ID for multi-org Grafana instances \(e.g., 1, 2\) |
717+
| `folderUid` | string | Yes | The UID of the folder to retrieve \(e.g., folder-abc123\) |
718+
719+
#### Output
720+
721+
| Parameter | Type | Description |
722+
| --------- | ---- | ----------- |
723+
| `id` | number | The numeric ID of the folder |
724+
| `uid` | string | The UID of the folder |
725+
| `title` | string | The title of the folder |
726+
| `url` | string | The URL path to the folder |
727+
| `parentUid` | string | Parent folder UID \(nested folders only\) |
728+
| `parents` | array | Ancestor folder hierarchy \(nested folders only\) |
729+
| `hasAcl` | boolean | Whether the folder has custom ACL permissions |
730+
| `canSave` | boolean | Whether the current user can save the folder |
731+
| `canEdit` | boolean | Whether the current user can edit the folder |
732+
| `canAdmin` | boolean | Whether the current user has admin rights on the folder |
733+
| `createdBy` | string | Username of who created the folder |
734+
| `created` | string | Timestamp when the folder was created |
735+
| `updatedBy` | string | Username of who last updated the folder |
736+
| `updated` | string | Timestamp when the folder was last updated |
737+
| `version` | number | Version number of the folder |
738+
739+
### `grafana_update_folder`
740+
741+
Update (rename) a folder. Fetches the current folder and merges your changes.
742+
743+
#### Input
744+
745+
| Parameter | Type | Required | Description |
746+
| --------- | ---- | -------- | ----------- |
747+
| `apiKey` | string | Yes | Grafana Service Account Token |
748+
| `baseUrl` | string | Yes | Grafana instance URL \(e.g., https://your-grafana.com\) |
749+
| `organizationId` | string | No | Organization ID for multi-org Grafana instances \(e.g., 1, 2\) |
750+
| `folderUid` | string | Yes | The UID of the folder to update \(e.g., folder-abc123\) |
751+
| `title` | string | Yes | New title for the folder |
752+
753+
#### Output
754+
755+
| Parameter | Type | Description |
756+
| --------- | ---- | ----------- |
757+
| `id` | number | The numeric ID of the folder |
758+
| `uid` | string | The UID of the folder |
759+
| `title` | string | The updated title of the folder |
760+
| `url` | string | The URL path to the folder |
761+
| `parentUid` | string | Parent folder UID \(nested folders only\) |
762+
| `parents` | array | Ancestor folder hierarchy \(nested folders only\) |
763+
| `hasAcl` | boolean | Whether the folder has custom ACL permissions |
764+
| `canSave` | boolean | Whether the current user can save the folder |
765+
| `canEdit` | boolean | Whether the current user can edit the folder |
766+
| `canAdmin` | boolean | Whether the current user has admin rights on the folder |
767+
| `createdBy` | string | Username of who created the folder |
768+
| `created` | string | Timestamp when the folder was created |
769+
| `updatedBy` | string | Username of who last updated the folder |
770+
| `updated` | string | Timestamp when the folder was last updated |
771+
| `version` | number | Version number of the folder |
772+
773+
### `grafana_delete_folder`
774+
775+
Delete a folder by its UID
776+
777+
#### Input
778+
779+
| Parameter | Type | Required | Description |
780+
| --------- | ---- | -------- | ----------- |
781+
| `apiKey` | string | Yes | Grafana Service Account Token |
782+
| `baseUrl` | string | Yes | Grafana instance URL \(e.g., https://your-grafana.com\) |
783+
| `organizationId` | string | No | Organization ID for multi-org Grafana instances \(e.g., 1, 2\) |
784+
| `folderUid` | string | Yes | The UID of the folder to delete \(e.g., folder-abc123\) |
785+
| `forceDeleteRules` | boolean | No | Delete any alert rules stored in the folder along with it \(default false\) |
786+
787+
#### Output
788+
789+
| Parameter | Type | Description |
790+
| --------- | ---- | ----------- |
791+
| `uid` | string | The UID of the deleted folder |
792+
| `message` | string | Confirmation message |
793+
794+
### `grafana_get_health`
795+
796+
Check the health of the Grafana instance (version, database status)
797+
798+
#### Input
799+
800+
| Parameter | Type | Required | Description |
801+
| --------- | ---- | -------- | ----------- |
802+
| `apiKey` | string | Yes | Grafana Service Account Token |
803+
| `baseUrl` | string | Yes | Grafana instance URL \(e.g., https://your-grafana.com\) |
804+
| `organizationId` | string | No | Organization ID for multi-org Grafana instances \(e.g., 1, 2\) |
805+
806+
#### Output
807+
808+
| Parameter | Type | Description |
809+
| --------- | ---- | ----------- |
810+
| `commit` | string | Git commit hash of the running Grafana build |
811+
| `database` | string | Database health status \(e.g., ok\) |
812+
| `version` | string | Grafana version |
813+
658814

0 commit comments

Comments
 (0)