#!/usr/bin/env node
import { Open5eClient } from './dist/open5e-client.js';
const client = new Open5eClient();
async function testAllMCPTools() {
console.log('š§Ŗ Testing all MCP tool functionality...\n');
try {
// Test 1: search_spells
console.log('1ļøā£ Testing search_spells...');
const searchResults = await client.searchSpells('fire', { limit: 5 });
console.log(` ā
Found ${searchResults.count} total, showing ${searchResults.results.length} spells`);
// Test 2: get_spell_details
console.log('\n2ļøā£ Testing get_spell_details...');
const fireball = await client.getSpellDetails('Fireball');
console.log(` ā
${fireball ? 'Found' : 'Not found'}: ${fireball?.name} (Level ${fireball?.level})`);
// Test 3: get_spell_by_level
console.log('\n3ļøā£ Testing get_spell_by_level...');
const level3Spells = await client.getSpellsByLevel(3);
console.log(` ā
Found ${level3Spells.count} level 3 spells, showing ${level3Spells.results.length}`);
// Test 4: get_spells_by_class
console.log('\n4ļøā£ Testing get_spells_by_class...');
const wizardSpells = await client.getSpellsByClass('wizard');
console.log(` ā
Found ${wizardSpells.length} wizard spells`);
// Test 5: search_classes
console.log('\n5ļøā£ Testing search_classes...');
const classes = await client.searchClasses();
console.log(` ā
Found ${classes.count} classes`);
// Test 6: get_class_details
console.log('\n6ļøā£ Testing get_class_details...');
const wizardClass = await client.getClassDetails('wizard');
console.log(` ā
${wizardClass ? 'Found' : 'Not found'}: ${wizardClass?.name}`);
// Test 7: search_races
console.log('\n7ļøā£ Testing search_races...');
const races = await client.searchRaces();
console.log(` ā
Found ${races.count} races, showing ${races.results.length}`);
// Test 8: get_race_details
console.log('\n8ļøā£ Testing get_race_details...');
const elf = await client.getRaceDetails('elf');
console.log(` ā
${elf ? 'Found' : 'Not found'}: ${elf?.name}`);
// Test 9: search_monsters
console.log('\n9ļøā£ Testing search_monsters...');
const monsters = await client.searchMonsters('dragon', { limit: 5 });
console.log(` ā
Found ${monsters.count} dragons, showing ${monsters.results.length}`);
// Test 10: search_weapons
console.log('\nš Testing search_weapons...');
const weapons = await client.searchWeapons('sword', { limit: 5 });
console.log(` ā
Found ${weapons.count} swords, showing ${weapons.results.length}`);
console.log('\nā
All MCP tools tested successfully!');
console.log('\nš Final cache stats:', client.getCacheStats());
} catch (error) {
console.error('ā Test failed:', error);
}
}
testAllMCPTools();