Skip to main content
Glama

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
NameRequiredDescriptionDefault
daoNameYesDAO 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"],
      },
    },
  • 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}`,
          },
        ],
      };
    }
  • 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"
              }`,
            },
          ],
        };
      }
    }
Install Server

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/baolongt/sns-mcp-server'

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