Skip to main content
Glama

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
player_idYes
table_idYes

Implementation Reference

  • 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); }
  • 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"], }, },
  • 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"], },
  • 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); }
  • 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); } }); }); }

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/freshlife001/mcp_poker'

If you have feedback or need assistance with the MCP directory API, please join our Discord server