login
Access and list all available poker tables by authenticating with a username. Use this to join Texas Holdem games on the MCP server.
Instructions
login and list all tables in the poker game
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes |
Implementation Reference
- src/mcpServer.ts:203-216 (handler)Executes the 'login' tool: registers the player with the given name, retrieves player ID, lists available poker tables with details.if (request.params.name === "login") { response = await sendPokerRequest('register', { name: args?.name }); view_text = `Logged in as ${args?.name}.\n Your PlayerID: ${response.playerId}.\n Available tables:\n`; // After login, fetch tables const tables = await sendPokerRequest('listTables', {}); if (tables && tables.length > 0) { tables.forEach((table: any, index: number) => { view_text += `Table: ${table.name} - TableID: ${table.id} - Players: ${table.players}/${table.maxPlayers} - Blinds: $${table.smallBlind}/$${table.bigBlind}\n`; }); } else { view_text += "No tables available. Create one to start playing."; } }
- src/mcpServer.ts:31-41 (registration)Registers the 'login' tool in the MCP server's listTools handler, defining its name, description, and input schema.{ name: "login", description: "login and list all tables in the poker game", inputSchema: { type: "object", properties: { name: { type: "string" }, }, required: ['name'], }, },
- src/mcpServer.ts:174-195 (helper)Helper function used by the 'login' handler to send 'register' and 'listTables' requests to the poker server via socket.io.function sendPokerRequest(method: string, params: any): Promise<any> { return new Promise((resolve, reject) => { const request = { method, params, id: Date.now() }; //console.log(`[Client] Sending request: ${method}`, params); socket.emit('action', request, (response: any) => { //console.log(`[Client] Received response for ${method}:`, response); if (response.error) { console.error(`[Client] Error in ${method}:`, response.error); reject(response.error); } else { resolve(response.result); } }); }); }