(ref: StructuredOutputSchemaRef)
| 224 | } |
| 225 | |
| 226 | export function getMcpOutputSchema(ref: StructuredOutputSchemaRef): JsonObject { |
| 227 | assertSchemaRef(ref); |
| 228 | const cacheKey = `${ref.schema}@${ref.version}`; |
| 229 | const cached = bundledSchemaCache.get(cacheKey); |
| 230 | if (cached) { |
| 231 | return cloneJson(cached); |
| 232 | } |
| 233 | |
| 234 | const rootSchema = readJsonObject(schemaPathFor(ref), `${ref.schema}@${ref.version}`); |
| 235 | |
| 236 | const schemasDir = getStructuredOutputSchemasDir(); |
| 237 | const commonSchemaPath = path.join(schemasDir, '_defs', 'common.schema.json'); |
| 238 | const commonSchema = readJsonObject(commonSchemaPath, 'common structured output definitions'); |
| 239 | const bundled = bundleSchema(rootSchema, commonSchema); |
| 240 | bundledSchemaCache.set(cacheKey, bundled); |
| 241 | return cloneJson(bundled); |
| 242 | } |
| 243 | |
| 244 | function getMcpOutputSchemaForRegistrationJson(ref: StructuredOutputSchemaRef): JsonObject { |
| 245 | const toolSchema = getMcpOutputSchema(ref); |
no test coverage detected