action_call
Execute a call action in Texas Holdem poker by specifying player and table IDs, enabling AI agents to participate in game decisions effectively.
Instructions
do action call
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"player_id": "<player_id>",
"table_id": "<table_id>"
},
"name": "action_call"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| player_id | Yes | ||
| table_id | Yes |
Implementation Reference
- src/mcpServer.ts:290-300 (handler)Handler for the 'action_call' tool. Sends a 'performAction' request to the poker server with action 'call', formats the response text, and polls for the updated table state until the player is active.
else if (request.params.name === "action_call") { response = await sendPokerRequest('performAction', { playerId: args?.player_id, tableId: args?.table_id, action: 'call' }); view_text = `Player ${args?.player_id} action: Call\n Game state:\n`; // Get updated table state view_text += await pollUntilPlayerActive(args?.player_id, args?.table_id); } - src/mcpServer.ts:128-139 (registration)Registration of the 'action_call' tool in the ListTools response, including name, description, and input schema.
{ 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/mcpServer.ts:131-138 (schema)Input schema definition for the 'action_call' tool, specifying required player_id and table_id as strings.
inputSchema: { type: "object", properties: { player_id: { type: "string" }, table_id: { type: "string" }, }, required: ["player_id", "table_id"], }, - src/mcpServer.ts:148-173 (helper)Helper function used by the handler to poll the table state until the specified player is the active player, then formats and returns the table state.
async function pollUntilPlayerActive(player_id:unknown, table_id:unknown) { let tableState = null; let counter = 0; while(true) { tableState = await sendPokerRequest('getTableState', { playerId: player_id, tableId: table_id }); counter ++; if (counter > 120) { break } const currentPlayer = tableState.players.find((p: any) => p.isActive); if (currentPlayer && currentPlayer.id === player_id) { break; } await sleep(1000); } if (tableState === null) { return ''; } return formatTableState(tableState); } - src/mcpServer.ts:174-195 (helper)Helper function to send requests to the poker server via socket.io and handle responses.
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); } }); }); }