fetch_poll_results
Get poll results from Geekbot to analyze responses or track progress. Use after listing polls to obtain the poll ID.
Instructions
Retrieves Geekbot poll results. Use this tool to analyze poll results or track progress of polls. This tool is usually used after the list_polls tool to get the poll id.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| poll_id | Yes | ID of the specific standup to fetch reports for. If not provided, reports for all standups will be fetched. | |
| before | No | Fetch results before this date (format: YYYY-MM-DD). This is not provided unless explicitly asked by the user. | |
| after | No | Fetch results after this date (format: YYYY-MM-DD). This is not provided unless explicitly asked by the user. |
Implementation Reference
- The main handler function that fetches poll results from Geekbot API via the client's get_poll_results method, parses the raw JSON response using poll_results_from_json_response, and returns formatted TextContent.
async def handle_fetch_poll_results( gb_client: GeekbotClient, poll_id: int, before: str | None = None, after: str | None = None, ) -> list[types.TextContent]: """Fetch poll results from Geekbot Args: poll_id: int, required, the ID of the poll to fetch results for before: str, optional, the date to fetch results before in YYYY-MM-DD format after: str, optional, the date to fetch results after in YYYY-MM-DD format Returns: str: Properly formatted JSON string of poll results """ poll_results = await gb_client.get_poll_results( poll_id=poll_id, before=before, after=after ) parsed_poll_results = poll_results_from_json_response(poll_results) return [ types.TextContent( type="text", text=json.dumps(parsed_poll_results.model_dump()), ) ] - The tool schema definition for fetch_poll_results, defining its name, description, and input schema with poll_id (required integer), before (optional date string), and after (optional date string) parameters.
fetch_poll_results = types.Tool( name="fetch_poll_results", description="Retrieves Geekbot poll results. Use this tool to analyze poll results or track progress of polls. This tool is usually used after the `list_polls` tool to get the poll id.", inputSchema={ "type": "object", "properties": { "poll_id": { "type": "integer", "description": "ID of the specific standup to fetch reports for. If not provided, reports for all standups will be fetched.", }, "before": { "type": "string", "description": "Fetch results before this date (format: YYYY-MM-DD). This is not provided unless explicitly asked by the user.", }, "after": { "type": "string", "description": "Fetch results after this date (format: YYYY-MM-DD). This is not provided unless explicitly asked by the user.", }, }, "required": ["poll_id"], }, ) - geekbot_mcp/tools/__init__.py:15-23 (registration)Registers fetch_poll_results in the list_tools() function so it appears in the MCP server's tool listing.
def list_tools() -> list[types.Tool]: return [ list_members, list_standups, fetch_reports, post_report, list_polls, fetch_poll_results, ] - geekbot_mcp/tools/__init__.py:26-45 (registration)Dispatches to handle_fetch_poll_results when the tool name 'fetch_poll_results' is matched in the run_tool function.
async def run_tool( gb_client: GeekbotClient, name: str, arguments: dict[str, str] | None, ) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]: match name: case "list_members": return await handle_list_members(gb_client) case "list_standups": return await handle_list_standups(gb_client) case "fetch_reports": return await handle_fetch_reports(gb_client, **arguments) case "post_report": return await handle_post_report(gb_client, **arguments) case "list_polls": return await handle_list_polls(gb_client) case "fetch_poll_results": return await handle_fetch_poll_results(gb_client, **arguments) case _: raise ValueError(f"Tool {name} not found") - geekbot_mcp/models.py:211-240 (helper)Helper functions (poll_results_from_json_response and its chain) that parse the raw API response into Pydantic models (PollResults -> PollQuestionResults -> PollQuestionResult -> PollChoiceResult).
def poll_choice_result_from_json_response(c_res: dict) -> PollChoiceResult: return PollChoiceResult( text=c_res["text"], votes=c_res["votes"], percentage=c_res["percentage"], users=[user_from_json_response(u) for u in c_res["users"]], ) def poll_question_result_from_json_response(q_res: dict) -> PollQuestionResult: return PollQuestionResult( date=q_res["date"], choices=[poll_choice_result_from_json_response(c) for c in q_res["answers"]], ) def poll_question_results_from_json_response(q_res: dict) -> PollQuestionResults: return PollQuestionResults( question_text=q_res["text"], results=[poll_question_result_from_json_response(r) for r in q_res["results"]], ) def poll_results_from_json_response(p_res: dict) -> PollResults: return PollResults( num_poll_instances=p_res["total_results"], question_results=[ poll_question_results_from_json_response(q) for q in p_res["questions"] ], )