{"version":3,"file":"schema.mjs","sources":["../../../src/tools/schema.ts"],"sourcesContent":["import { tool, type StructuredToolInterface } from '@langchain/core/tools';\nimport type { LCTool } from '@/types';\n\n/**\n * Creates a schema-only tool for LLM binding in event-driven mode.\n * These tools have valid schemas for the LLM to understand but should\n * never be invoked directly - ToolNode handles execution via events.\n */\nexport function createSchemaOnlyTool(\n  definition: LCTool\n): StructuredToolInterface {\n  const { name, description, parameters, responseFormat } = definition;\n\n  return tool(\n    async () => {\n      throw new Error(\n        `Tool \"${name}\" should not be invoked directly in event-driven mode. ` +\n          'ToolNode should dispatch ON_TOOL_EXECUTE events instead.'\n      );\n    },\n    {\n      name,\n      description: description ?? '',\n      schema: parameters ?? { type: 'object', properties: {} },\n      responseFormat: responseFormat ?? 'content_and_artifact',\n    }\n  );\n}\n\n/**\n * Creates schema-only tools for all definitions in an array.\n */\nexport function createSchemaOnlyTools(\n  definitions: LCTool[]\n): StructuredToolInterface[] {\n  return definitions.map((def) => createSchemaOnlyTool(def));\n}\n"],"names":[],"mappings":";;AAGA;;;;AAIG;AACG,SAAU,oBAAoB,CAClC,UAAkB,EAAA;IAElB,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,UAAU,EAAE,cAAc,EAAE,GAAG,UAAU;AAEpE,IAAA,OAAO,IAAI,CACT,YAAW;AACT,QAAA,MAAM,IAAI,KAAK,CACb,CAAA,MAAA,EAAS,IAAI,CAAA,uDAAA,CAAyD;AACpE,YAAA,0DAA0D,CAC7D;AACH,IAAA,CAAC,EACD;QACE,IAAI;QACJ,WAAW,EAAE,WAAW,IAAI,EAAE;QAC9B,MAAM,EAAE,UAAU,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,EAAE;QACxD,cAAc,EAAE,cAAc,IAAI,sBAAsB;AACzD,KAAA,CACF;AACH;AAEA;;AAEG;AACG,SAAU,qBAAqB,CACnC,WAAqB,EAAA;AAErB,IAAA,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,oBAAoB,CAAC,GAAG,CAAC,CAAC;AAC5D;;;;"}