Skip to main content
Glama

list_proposals

Fetch up to 10 recent governance proposals for a specified Snapshot space. Enables tracking and analysis of decentralized decision-making in DAOs.

Instructions

Fetch a list of recent proposals for a given Snapshot space. Parameters: space_id (str): The unique identifier of the Snapshot space (e.g., 'ens.eth'). Returns: A formatted string containing details of up to 10 recent proposals.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
space_idYes

Implementation Reference

  • main.py:60-107 (handler)
    The core handler function for the 'list_proposals' tool. It is decorated with @mcp.tool(), which registers it in the MCP server. The function fetches the 10 most recent proposals from the Snapshot GraphQL API for the given space_id, formats their details (ID, title, state, created/end times using helper ts2str), and returns a formatted string.
    async def list_proposals(space_id: str, ctx: Context) -> str: """ Fetch a list of recent proposals for a given Snapshot space. Parameters: space_id (str): The unique identifier of the Snapshot space (e.g., 'ens.eth'). Returns: A formatted string containing details of up to 10 recent proposals. """ query = """ query Proposals($space: String!) { proposals(first: 10, orderBy: "created", orderDirection: desc, where: { space: $space }) { id title state created end } } """ async with httpx.AsyncClient() as client: try: response = await client.post( SNAPSHOT_API, json={"query": query, "variables": {"space": space_id}} ) response.raise_for_status() data = response.json() proposals = data.get("data", {}).get("proposals", []) # Format proposals as a readable string result = [] for i, proposal in enumerate(proposals): created_str = ts2str(proposal['created']) end_str = ts2str(proposal['end']) result.append( 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" "---" ) return "\n".join(result) if result else "No proposals found" except Exception as e: return f"Error: {str(e)}"
  • main.py:13-15 (helper)
    Supporting helper function to convert Unix timestamps to readable datetime strings, used in list_proposals for formatting proposal created and end times.
    def ts2str(ts: int) -> str: dt = datetime.fromtimestamp(ts) return dt.strftime("%Y-%m-%d %H:%M:%S")
  • main.py:61-69 (schema)
    Type hints and docstring defining the input schema (space_id: str) and output (str), which FastMCP uses for tool schema.
    """ Fetch a list of recent proposals for a given Snapshot space. Parameters: space_id (str): The unique identifier of the Snapshot space (e.g., 'ens.eth'). Returns: A formatted string containing details of up to 10 recent proposals. """

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

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