2025-10-28 13:17:06 +05:30
|
|
|
import { z } from "zod";
|
2025-11-07 11:42:10 +05:30
|
|
|
|
2025-11-15 01:51:22 +05:30
|
|
|
export const BaseTool = z.object({
|
2025-11-07 11:42:10 +05:30
|
|
|
name: z.string(),
|
|
|
|
|
});
|
|
|
|
|
|
2025-11-15 01:51:22 +05:30
|
|
|
export const BuiltinTool = BaseTool.extend({
|
2025-11-07 11:42:10 +05:30
|
|
|
type: z.literal("builtin"),
|
|
|
|
|
});
|
|
|
|
|
|
2025-11-15 01:51:22 +05:30
|
|
|
export const McpTool = BaseTool.extend({
|
2025-11-07 11:42:10 +05:30
|
|
|
type: z.literal("mcp"),
|
|
|
|
|
description: z.string(),
|
|
|
|
|
inputSchema: z.any(),
|
|
|
|
|
mcpServerName: z.string(),
|
|
|
|
|
});
|
|
|
|
|
|
2025-11-15 01:51:22 +05:30
|
|
|
export const AgentAsATool = BaseTool.extend({
|
|
|
|
|
type: z.literal("agent"),
|
2025-11-07 11:42:10 +05:30
|
|
|
});
|
|
|
|
|
|
2025-11-15 01:51:22 +05:30
|
|
|
export const ToolAttachment = z.discriminatedUnion("type", [
|
|
|
|
|
BuiltinTool,
|
|
|
|
|
McpTool,
|
|
|
|
|
AgentAsATool,
|
2025-11-07 11:42:10 +05:30
|
|
|
]);
|
|
|
|
|
|
2025-10-28 13:17:06 +05:30
|
|
|
export const Agent = z.object({
|
|
|
|
|
name: z.string(),
|
2025-11-14 09:13:28 +05:30
|
|
|
provider: z.string().optional(),
|
|
|
|
|
model: z.string().optional(),
|
2025-10-28 13:17:06 +05:30
|
|
|
description: z.string(),
|
|
|
|
|
instructions: z.string(),
|
2025-11-15 01:51:22 +05:30
|
|
|
tools: z.record(z.string(), ToolAttachment).optional(),
|
2025-10-28 13:17:06 +05:30
|
|
|
});
|