list_proposals
Retrieve all proposals for a specific DAO using the MCP SNS Server, enabling users to stay informed, manage governance tasks, and participate in decision-making processes effectively.
Instructions
List all proposals
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| daoName | Yes | DAO name |
Implementation Reference
- src/index.ts:58-71 (registration)Registration of the 'list_proposals' tool, including name, description, and input schema (requires daoName).{ name: "list_proposals", description: "List all proposals", inputSchema: { type: "object", properties: { daoName: { type: "string", description: "DAO name", }, }, required: ["daoName"], }, },
- src/index.ts:177-198 (handler)Main handler for 'list_proposals' tool: validates daoName, resolves canister ID via searchDAOs, calls snsClient.listProposals, and returns result or error message.case "list_proposals": { const daoName = String(request.params.arguments?.daoName); if (!daoName) { throw new Error("daoName is required"); } let canister_id = searchDAOs(daoName); if (canister_id) { const proposals = await snsClient.listProposals(canister_id); return proposals; } return { content: [ { type: "text", text: `No proposals found for DAO: ${daoName}`, }, ], }; }
- src/sns-utils.ts:41-75 (helper)Helper function listProposals in SnsClient: fetches proposals using SNS wrapper with optional limit (default 100), formats as text content or error.async listProposals(canisterId: string, limit: number = 100) { try { const snsWrapper = await this.getSnsWrapper(canisterId); // Fetch proposals from the SNS const listProposalsRes = await snsWrapper.listProposals({ limit, }); // Get the proposal list const proposalList = listProposalsRes.proposals; // Return the proposals as a formatted JSON string return { content: [ { type: "text", text: `proposals: ${safeParseJSON(proposalList)}`, }, ], }; } catch (error) { // Return an error message if the fetch fails return { content: [ { type: "text", text: `Error fetching proposals: ${ error instanceof Error ? error.message : "Unknown error" }`, }, ], }; } }