Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | 17x 17x 17x 17x 17x 17x 17x | import { z } from "zod";
import { paginationFields } from "../utils";
import { IntegrationTypeSchema } from "./schema";
// ============================================================================
// browse_integrations - CQRS Query Tool (discriminated union schema)
// Actions: list, get
//
// Uses z.discriminatedUnion() on "action" for type-safe action handling.
// - action="list": List all active integrations for a project
// - action="get": Retrieve settings for a specific integration
// ============================================================================
// --- Shared fields ---
const projectIdField = z.string().describe("Project ID or URL-encoded path");
// --- Action: list ---
const ListIntegrationsSchema = z.object({
action: z.literal("list").describe("List all active integrations for a project"),
project_id: projectIdField,
...paginationFields(),
});
// --- Action: get ---
const GetIntegrationSchema = z.object({
action: z.literal("get").describe("Get integration settings (read-only)"),
project_id: projectIdField,
integration: IntegrationTypeSchema.describe(
"Integration type slug (e.g., slack, jira, discord). Note: gitlab-slack-application cannot be created via API - it requires OAuth installation from GitLab UI."
),
});
// --- Discriminated union combining all actions ---
export const BrowseIntegrationsSchema = z.discriminatedUnion("action", [
ListIntegrationsSchema,
GetIntegrationSchema,
]);
// ============================================================================
// Type exports
// ============================================================================
export type BrowseIntegrationsInput = z.infer<typeof BrowseIntegrationsSchema>;
|