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
| Name | Required | Description | Default |
|---|---|---|---|
| proposalId | Yes | ID of the proposal |
Implementation Reference
- src/server.ts:172-180 (handler)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) }] };
- src/server.ts:28-30 (schema)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; }