Skip to main content
Glama

getProposal

Retrieve detailed information about a specific Snapshot.org proposal using its unique ID to analyze governance decisions and voting data.

Instructions

Get details of a specific proposal

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
proposalIdYesID of the proposal

Implementation Reference

  • MCP tool handler for 'getProposal': validates input arguments using Zod schema and delegates execution to SnapshotService.getProposal, returning the result as JSON string.
    case "getProposal": {
      const parsedArgs = ProposalParamsSchema.parse(args);
      const proposal = await this.snapshotService.getProposal(parsedArgs.proposalId);
      return {
        content: [{
          type: "text",
          text: JSON.stringify(proposal, null, 2)
        }]
      };
  • Zod schema defining the input parameters for the getProposal tool (proposalId: string). Used for runtime validation in the handler.
    const ProposalParamsSchema = z.object({
      proposalId: z.string()
    });
  • src/server.ts:93-103 (registration)
    Registers the 'getProposal' tool in the MCP tools/list response, providing name, description, and JSON inputSchema for validation.
    {
      name: "getProposal",
      description: "Get details of a specific proposal",
      inputSchema: {  // Changed from parameters to inputSchema
        type: "object",
        properties: {
          proposalId: { type: "string", description: "ID of the proposal" }
        },
        required: ["proposalId"]
      }
    },
  • Core implementation of getProposal: executes GraphQL query against Snapshot API to fetch detailed proposal information by ID.
    async getProposal(proposalId: string): Promise<Proposal> {
      const query = `
        query Proposal {
          proposal(id: "${proposalId}") {
            id
            title
            body
            choices
            start
            end
            snapshot
            state
            author
            space {
              id
              name
            }
          }
        }
      `;
    
      const result = await this.queryGraphQL(query);
      return result.proposal;
    }

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/crazyrabbitLTC/mcp-snapshot-server'

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