"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const index_js_1 = require("@modelcontextprotocol/sdk/client/index.js");
const stdio_js_1 = require("@modelcontextprotocol/sdk/client/stdio.js");
async function main() {
const transport = new stdio_js_1.StdioClientTransport({
command: "node",
args: ["./build/index.js"],
});
const client = new index_js_1.Client({ name: "test-v1.1", version: "1.1.0" }, { capabilities: {} });
await client.connect(transport);
console.log("✅ Connecté.");
try {
// 1. Test: Unlimited movies
console.log("\n🎬 Test: 30 premiers films à l'affiche (2 pages)...");
const nowShowingResult = await client.callTool({
name: "get_movies_now_showing",
arguments: { max_pages: 2 },
});
// @ts-ignore
const movies = JSON.parse(nowShowingResult.content[0].text);
console.log(` Nombre de films récupérés : ${movies.length}`);
console.log(` Ex: ${movies[0].title}, ${movies[movies.length - 1].title}`);
// 2. Test: Search cinema and cards
console.log("\n🏢 Test: Recherche du cinéma 'Grand Rex'...");
const searchCinemaResult = await client.callTool({
name: "search_cinemas",
arguments: { query: "Grand Rex" },
});
// @ts-ignore
const cinemas = JSON.parse(searchCinemaResult.content[0].text);
if (cinemas.length > 0) {
const rex = cinemas[0];
console.log(` Trouvé : ${rex.name} (ID: ${rex.id})`);
console.log(` UGC Illimité: ${rex.cards.ugcIllimite ? "OUI" : "NON"}`);
console.log(` Pathé Cinépass: ${rex.cards.patheCinepass ? "OUI" : "NON"}`);
// 3. Test: Cinema program
console.log(`\n📅 Test: Programmation complète du cinéma ${rex.name}...`);
const programResult = await client.callTool({
name: "get_cinema_showtimes",
arguments: { cinema_id: rex.id }
});
// @ts-ignore
const program = JSON.parse(programResult.content[0].text);
console.log(` Nombre de films à l'affiche au ${rex.name} : ${program.length}`);
if (program.length > 0) {
const first = program[0];
console.log(` Premier film : ${first.movieTitle}`);
console.log(` Horaires : ${first.formats[0].showtimes.map((s) => s.startTime).join(", ")}`);
}
}
else {
console.error("❌ Grand Rex non trouvé !");
}
}
catch (error) {
console.error("❌ Erreur :", error);
}
finally {
await client.close();
}
}
main();