Skip to main content
Glama

getProposals

Retrieve all proposals for a specific DAO using the Futarchy MCP Server. Input the DAO ID to access, manage, and interact with proposals effectively.

Instructions

Get all proposals for a specific DAO

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
daoIdYesThe ID of the DAO to get proposals for

Implementation Reference

  • The handler function for the 'getProposals' MCP tool. It takes a daoId parameter, fetches proposals using apiClient.getProposals, and returns a formatted text response with JSON data or an error.
    server.tool("getProposals", "Get all proposals for a specific DAO", { daoId: z.string().describe("The ID of the DAO to get proposals for"), }, async ({ daoId }) => { try { const response = await apiClient.getProposals(daoId); if (!response.success) { return { content: [ { type: "text", text: response.error || 'Unknown error', }, ], isError: true, }; } return { content: [ { type: "text", text: JSON.stringify(response.data, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error fetching proposals: ${error.message || 'Unknown error'}`, }, ], isError: true, }; } });
  • Zod schema defining the input parameters for the getProposals tool (daoId). Note: Inline schema in handler matches this.
    export const GetProposalsParamsSchema = z.object({ daoId: z.string().describe("The ID of the DAO to get proposals for"), });
  • Helper function in FutarchyApiClient that performs the HTTP fetch to retrieve proposals for a given DAO ID from the backend API.
    async getProposals(daoId) { try { const response = await fetch(`${this.baseUrl}/daos/${daoId}/proposals`); if (!response.ok) { throw new Error(`HTTP error! Status: ${response.status}`); } const data = await response.json(); return { success: true, data: data.proposals }; } catch (error) { return { success: false, error: error.message || `Failed to fetch proposals for DAO: ${daoId}` }; }
  • Registration of the 'getProposals' tool on the MCP server, including input schema and handler.
    server.tool("getProposals", "Get all proposals for a specific DAO", { daoId: z.string().describe("The ID of the DAO to get proposals for"), }, async ({ daoId }) => { try { const response = await apiClient.getProposals(daoId); if (!response.success) { return { content: [ { type: "text", text: response.error || 'Unknown error', }, ], isError: true, }; } return { content: [ { type: "text", text: JSON.stringify(response.data, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error fetching proposals: ${error.message || 'Unknown error'}`, }, ], isError: true, }; } });

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/TanmayDhobale/FutarchyMCPServer'

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