"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AgentCoreCliMcpDefsSchema = exports.ToolDefinitionSchema = exports.ToolNameSchema = exports.SchemaDefinitionSchema = exports.SchemaPrimitiveTypeSchema = void 0;
const zod_1 = require("zod");
// ============================================================================
// Schema Primitive Types
// ============================================================================
exports.SchemaPrimitiveTypeSchema = zod_1.z.enum(['string', 'number', 'object', 'array', 'boolean', 'integer']);
exports.SchemaDefinitionSchema = zod_1.z.object({
    type: exports.SchemaPrimitiveTypeSchema,
    description: zod_1.z.string().optional(),
    items: zod_1.z.lazy(() => exports.SchemaDefinitionSchema).optional(),
    properties: zod_1.z.lazy(() => zod_1.z.record(zod_1.z.string(), exports.SchemaDefinitionSchema)).optional(),
    required: zod_1.z.array(zod_1.z.string()).optional(),
});
// ============================================================================
// Tool Definition
// ============================================================================
/**
 * Tool name validation for CLI input.
 * Allows alphanumeric characters, hyphens, and underscores.
 * This is a general-purpose schema for tool names that works for both
 * MCP runtime tools (direct) and gateway target tools.
 */
exports.ToolNameSchema = zod_1.z
    .string()
    .min(1, 'Tool name is required')
    .max(128, 'Tool name must be at most 128 characters')
    .regex(/^[a-zA-Z][a-zA-Z0-9_-]*$/, 'Tool name must start with a letter and contain only alphanumeric characters, hyphens, or underscores');
/**
 * Gateway Target Definition schema.
 */
exports.ToolDefinitionSchema = zod_1.z
    .object({
    name: zod_1.z.string().min(1).max(128),
    description: zod_1.z.string().min(1),
    inputSchema: exports.SchemaDefinitionSchema,
    outputSchema: exports.SchemaDefinitionSchema.optional(),
})
    .strict();
// ============================================================================
// MCP Definitions File (mcp-defs.json)
// ============================================================================
/**
 * Top-level MCP definitions file schema (mcp-defs.json).
 */
exports.AgentCoreCliMcpDefsSchema = zod_1.z.object({
    tools: zod_1.z.record(zod_1.z.string(), exports.ToolDefinitionSchema),
});
//# sourceMappingURL=mcp-defs.js.map