tool-output.ts 597 B

123456789101112131415161718
  1. export * as ToolOutput from "./tool-output"
  2. import { Schema } from "effect"
  3. export class TextContent extends Schema.Class<TextContent>("Tool.TextContent")({
  4. type: Schema.Literal("text"),
  5. text: Schema.String,
  6. }) {}
  7. export class FileContent extends Schema.Class<FileContent>("Tool.FileContent")({
  8. type: Schema.Literal("file"),
  9. uri: Schema.String,
  10. mime: Schema.String,
  11. name: Schema.String.pipe(Schema.optional),
  12. }) {}
  13. export const Content = Schema.Union([TextContent, FileContent]).pipe(Schema.toTaggedUnion("type"))
  14. export const Structured = Schema.Record(Schema.String, Schema.Any)