/**
* MCP Tool: Load Range
*/
import { RangeLoader } from '../ranges/loader.js';
export class LoadRangeTool {
constructor(solverPath) {
this.rangeLoader = new RangeLoader(solverPath);
}
/**
* Load and parse a range file
* @param {Object} params
* @returns {Promise<Object>}
*/
async execute(params) {
try {
const { range_path } = params;
if (!range_path) {
return {
success: false,
error: 'range_path is required',
error_type: 'VALIDATION_ERROR'
};
}
const result = await this.rangeLoader.loadRange(range_path);
return {
success: true,
range_string: result.range_string,
parsed_hands: result.parsed_hands,
hand_count: result.hand_count,
total_combos: result.total_combos
};
} catch (error) {
return {
success: false,
error: error.message,
error_type: 'EXECUTION_ERROR'
};
}
}
}
/**
* Create the MCP tool definition
* @returns {Object}
*/
export function createLoadRangeTool() {
return {
name: 'load_range',
description: 'Load and parse a poker range file from the TexasSolver ranges directory.',
inputSchema: {
type: 'object',
properties: {
range_path: {
type: 'string',
description: 'Path to range file relative to ranges/ directory (e.g., "6max_range/BTN") or absolute path'
}
},
required: ['range_path']
}
};
}
export default LoadRangeTool;