Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/openstatusHQ/openstatus. ๐ซ Status page with uptime monitoring & API monitoring as code ๐ซ openstatus.dev
bun drizzle-orm monitoring monitoring-as-code nextjs observability on-call open-source shadcn-ui status-page statuspage synthetic-monitoring tinybird turso uptime uptime-checker uptime-monitor
Something went wrong. Try again.
1.7 kB ยท 55 lines
TypeScript
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556import { pageComponentTypes } from "@openstatus/db/src/schema";import { z } from "zod";
import { listPageComponents } from "../page-component";import type { AgentTool } from "./types";
const ListPageComponentsInputShape = z.object({ pageId: z .number() .int() .optional() .describe( "If set, only components belonging to this page. Resolve via list_status_pages.", ),});
const ListPageComponentsOutput = z.object({ items: z.array( z.object({ id: z.number().int(), name: z.string(), type: z.enum(pageComponentTypes), pageId: z.number().int(), monitorId: z.number().int().nullable(), }), ),});
export const listPageComponentsTool: AgentTool< z.infer<typeof ListPageComponentsInputShape>, z.infer<typeof ListPageComponentsOutput>> = { name: "list_page_components", description: "List page components in this workspace with their id, name, type ('monitor' or 'static'), pageId and linked monitorId. Use to discover the pageComponentIds required by create_status_report, create_maintenance, and update_status_report โ those tools reject ids that don't belong to the workspace/page.", scope: "read", destructive: false, inputSchema: ListPageComponentsInputShape, outputSchema: ListPageComponentsOutput, async run({ ctx, input }) { const components = await listPageComponents({ ctx, input: { pageId: input.pageId, order: "asc" }, }); return { items: components.map((c) => ({ id: c.id, name: c.name, type: c.type, pageId: c.pageId, monitorId: c.monitorId ?? null, })), }; },};