Skip to main content
Glama

get_proposal_details

Fetch detailed information about a specific DAO governance proposal using its unique identifier to analyze decentralized decision-making.

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
NameRequiredDescriptionDefault
proposal_idYes

Implementation Reference

  • main.py:109-164 (handler)
    The handler function decorated with @mcp.tool() that implements the core logic for fetching and formatting detailed information about a Snapshot proposal using GraphQL query to the Snapshot API.
    @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)}"
  • main.py:13-15 (helper)
    Helper utility function to convert Unix timestamps to readable datetime strings, used within get_proposal_details for formatting created and end times.
    def ts2str(ts: int) -> str:
      dt = datetime.fromtimestamp(ts)
      return dt.strftime("%Y-%m-%d %H:%M:%S")
  • main.py:109-109 (registration)
    The @mcp.tool() decorator registers the get_proposal_details function as an MCP tool.
    @mcp.tool()

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/kukapay/dao-proposals-mcp'

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