get_proposal_details
Retrieve comprehensive details for a specific DAO governance proposal by providing its unique ID. Enables real-time tracking and analysis of decentralized decision-making processes.
Instructions
Fetch detailed information for a specific proposal.
Parameters:
proposal_id (str): The unique identifier of the proposal.
Returns:
A formatted string containing detailed information about the proposal.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| proposal_id | Yes |
Implementation Reference
- main.py:109-164 (handler)The handler function for the 'get_proposal_details' tool, decorated with @mcp.tool() for automatic registration. It queries the Snapshot GraphQL API for proposal details using the provided proposal_id, formats the response with timestamps converted via ts2str helper, and returns a detailed string summary.@mcp.tool() async def get_proposal_details(proposal_id: str, ctx: Context) -> str: """ Fetch detailed information for a specific proposal. Parameters: proposal_id (str): The unique identifier of the proposal. Returns: A formatted string containing detailed information about the proposal. """ query = """ query Proposal($id: String!) { proposal(id: $id) { id title body state created end choices scores votes } } """ async with httpx.AsyncClient() as client: try: response = await client.post( SNAPSHOT_API, json={"query": query, "variables": {"id": proposal_id}} ) response.raise_for_status() data = response.json() proposal = data.get("data", {}).get("proposal") if not proposal: return "Proposal not found" created_str = ts2str(proposal['created']) end_str = ts2str(proposal['end']) return ( f"Proposal ID: {proposal['id']}\n" f"Title: {proposal['title']}\n" f"State: {proposal['state']}\n" f"Created: {created_str}\n" f"End: {end_str}\n" f"Choices: {', '.join(proposal['choices'])}\n" f"Scores: {proposal['scores']}\n" f"Votes: {proposal['votes']}\n" "------\n" f"{proposal['body']}" ) except Exception as e: return f"Error: {str(e)}"