"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createMcpToolResultBuilders = exports.defaultAgentToModelOutput = exports.assertAvailable = exports.resolveDescription = void 0;
const resolveDescription = (description, context) => typeof description === 'function' ? description(context) : description;
exports.resolveDescription = resolveDescription;
const assertAvailable = (name, availability, runtime) => {
    if (!availability.includes(runtime)) {
        throw new Error(`Tool "${name}" is not available in the ${runtime} runtime`);
    }
};
exports.assertAvailable = assertAvailable;
const defaultAgentToModelOutput = ({ output }) => output.metadata.status === 'error'
    ? { type: 'error-text', value: output.result }
    : { type: 'text', value: output.result };
exports.defaultAgentToModelOutput = defaultAgentToModelOutput;
const text = (textContent) => ({
    content: [{ type: 'text', text: textContent }],
});
const error = (textContent) => ({
    isError: true,
    content: [{ type: 'text', text: textContent }],
});
const structured = (textContent, structuredContent) => ({
    content: [{ type: 'text', text: textContent }],
    structuredContent,
});
const createMcpToolResultBuilders = () => ({
    text,
    error,
    structured,
});
exports.createMcpToolResultBuilders = createMcpToolResultBuilders;
//# sourceMappingURL=toolDefinitionUtils.js.map