/**
 * Factory function to create a type-safe ToolDefinition.
 */
export function defineTool(definition) {
    return definition;
}
// ============================================================================
// Helper Functions to Create Tools
// ============================================================================
/**
 * Creates a server-side tool from a definition and execute function.
 */
export function implementServerTool(definition, execute) {
    return {
        definition,
        executor: 'server',
        execute,
    };
}
/**
 * Creates a client-side tool from a definition and execute function.
 */
export function implementClientTool(definition, execute) {
    return {
        definition,
        executor: 'client',
        execute,
    };
}
/**
 * Creates a client-side tool with server preparation from a definition and serverPrepare function.
 */
export function prepareClientTool(definition, serverPrepare) {
    if (!definition.serverPrepareResultSchema) {
        throw new Error(`Tool ${definition.name} requires serverPrepareResultSchema to use implementClientToolWithServerPrepare`);
    }
    return {
        definition,
        executor: 'client',
        serverPrepare,
    };
}
/**
 * Creates a client-side tool from a definition. This has no server-side preparation and no
 * execution logic. It's only used in the tool looping code so that the client tool definitions
 * are available to the models.
 */
export function createClientTool(definition) {
    return {
        definition,
        executor: 'client',
    };
}
// ============================================================================
// Type Guards
// ============================================================================
/**
 * Type guard to check if a tool is a server-side tool.
 */
export function isServerTool(tool) {
    return tool.executor === 'server';
}
/**
 * Type guard to check if a tool is a client-side tool with server preparation.
 */
export function isPreparedClientTool(tool) {
    return tool.executor === 'client' && 'serverPrepare' in tool && typeof tool.serverPrepare === 'function';
}
/**
 * Type guard to check if a tool is a pure client-side tool without server preparation.
 */
export function isPureClientSideTool(tool) {
    return tool.executor === 'client' && !('serverPrepare' in tool);
}
//# sourceMappingURL=toolDefinition.js.map