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
| Name | Required | Description | Default |
|---|---|---|---|
| daoId | Yes | The ID of the DAO to get proposals for |
Implementation Reference
- dist/mcp/server/index.js:124-160 (handler)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, }; } });
- dist/mcp/common/types.js:45-47 (schema)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"), });
- dist/mcp/common/api.js:46-63 (helper)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}` }; }
- dist/mcp/server/index.js:124-160 (registration)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, }; } });