leave_table
Use this tool to exit a poker table on the Texas Holdem MCP Server by specifying the player ID and table ID to remove a player from the game.
Instructions
Leave a poker table
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| player_id | Yes | ||
| table_id | Yes |
Implementation Reference
- src/mcpServer.ts:237-243 (handler)MCP tool handler for 'leave_table': invokes internal 'leaveTable' RPC on PokerServer with playerId and tableId, sets response text.else if (request.params.name === "leave_table") { response = await sendPokerRequest('leaveTable', { playerId: args?.player_id, tableId: args?.table_id }); view_text = `Player ${args?.player_id} left table ${args?.table_id}. Game state:\n`; }
- src/mcpServer.ts:66-77 (schema)Input schema for 'leave_table' tool as defined in the listTools response.{ name: "leave_table", description: "Leave a poker table", inputSchema: { type: "object", properties: { player_id: { type: "string" }, table_id: { type: "string" }, }, required: ["player_id", "table_id"], }, },
- src/mcpServer.ts:29-142 (registration)Tool registration in the ListToolsRequest handler, including 'leave_table' among other tools.return { tools: [ { name: "login", description: "login and list all tables in the poker game", inputSchema: { type: "object", properties: { name: { type: "string" }, }, required: ['name'], }, }, { name: "join_table", description: "Join a poker table", inputSchema: { type: "object", properties: { player_id: { type: "string" }, table_id: { type: "string" }, }, required: ["player_id", "table_id"], }, }, { name: "get_table_status", description: "Get the current status of a poker table", inputSchema: { type: "object", properties: { player_id: { type: "string" }, table_id: { type: "string" }, }, required: ["player_id", "table_id"], }, }, { name: "leave_table", description: "Leave a poker table", inputSchema: { type: "object", properties: { player_id: { type: "string" }, table_id: { type: "string" }, }, required: ["player_id", "table_id"], }, }, { name: "action_check", description: "do action check", inputSchema: { type: "object", properties: { player_id: { type: "string" }, table_id: { type: "string" }, }, required: ["player_id", "table_id"], }, }, { name: "action_fold", description: "do action fold", inputSchema: { type: "object", properties: { player_id: { type: "string" }, table_id: { type: "string" }, }, required: ["player_id", "table_id"], }, }, { name: "action_bet", description: "do action bet", inputSchema: { type: "object", properties: { player_id: { type: "string" }, table_id: { type: "string" }, amount: { type: "number" }, }, required: ["player_id", "table_id", 'amount'], }, }, { name: "action_raise", description: "do action raise", inputSchema: { type: "object", properties: { player_id: { type: "string" }, table_id: { type: "string" }, amount: { type: "number" }, }, required: ["player_id", "table_id", 'amount'], }, }, { name: "action_call", description: "do action call", inputSchema: { type: "object", properties: { player_id: { type: "string" }, table_id: { type: "string" }, }, required: ["player_id", "table_id"], }, }, ], }; });
- src/services/PokerServer.ts:236-257 (helper)PokerServer RPC handler for 'leaveTable', called by MCP tool. Validates playerId and calls GameManager.leaveTable.private handleLeaveTable(params: any, id: string | number): PokerResponse { const { playerId } = params; if (!playerId) { return { error: { code: -32602, message: 'Invalid params: playerId is required' }, id }; } const success = this.gameManager.leaveTable(playerId); return { result: { success }, id }; }
- src/services/GameManager.ts:53-77 (helper)GameManager method implementing table leaving logic: finds player's table and removes them from it.leaveTable(playerId: string): boolean { const tableId = this.playerTables.get(playerId); if (!tableId) { return false; } const table = this.tables.get(tableId); if (!table) { this.playerTables.delete(playerId); return false; } const success = table.removePlayer(playerId); if (success) { this.playerTables.delete(playerId); // Comment out or remove this code that deletes empty tables // If table is empty, remove it // if (table.players.length === 0) { // this.tables.delete(tableId); // } } return success; }