getProposal
Retrieve a specific proposal by ID using the Futarchy MCP Server to manage DAOs and proposals on the Solana protocol through API or chat interfaces.
Instructions
Get a specific proposal by ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| proposalId | Yes | The ID of the proposal to retrieve |
Implementation Reference
- src/mcp/server/index.ts:192-227 (handler)Handler function that executes the getProposal tool: destructures proposalId, calls apiClient.getProposal, handles success/error by returning MCP formatted content with JSON stringified data or error text.async ({ proposalId }) => { try { const response = await apiClient.getProposal(proposalId); if (!response.success) { return { content: [ { type: "text" as const, text: response.error || 'Unknown error', }, ], isError: true, }; } return { content: [ { type: "text" as const, text: JSON.stringify(response.data, null, 2), }, ], }; } catch (error: any) { return { content: [ { type: "text" as const, text: `Error fetching proposal: ${error.message || 'Unknown error'}`, }, ], isError: true, }; } }
- src/mcp/server/index.ts:186-228 (registration)Registration of the 'getProposal' tool on the MCP server using server.tool(name, description, inputSchema, handler), with inline Zod schema.server.tool( "getProposal", "Get a specific proposal by ID", { proposalId: z.string().describe("The ID of the proposal to retrieve"), }, async ({ proposalId }) => { try { const response = await apiClient.getProposal(proposalId); if (!response.success) { return { content: [ { type: "text" as const, text: response.error || 'Unknown error', }, ], isError: true, }; } return { content: [ { type: "text" as const, text: JSON.stringify(response.data, null, 2), }, ], }; } catch (error: any) { return { content: [ { type: "text" as const, text: `Error fetching proposal: ${error.message || 'Unknown error'}`, }, ], isError: true, }; } } );
- src/mcp/common/types.ts:67-69 (schema)Zod schema definition for GetProposalParamsSchema used potentially in tool definitions.export const GetProposalParamsSchema = z.object({ proposalId: z.string().describe("The ID of the proposal to retrieve"), });
- src/mcp/common/api.ts:76-110 (helper)FutarchyApiClient.getProposal helper: HTTP fetch proposal from backend, augments with sentiment analysis from getProposalSentimentAnalysis.async getProposal(proposalId: string): Promise<Response> { try { const response = await fetch(`${this.baseUrl}/proposals/${proposalId}`); if (!response.ok) { throw new Error(`HTTP error! Status: ${response.status}`); } const data = await response.json(); // Get sentiment analysis for this proposal try { const sentimentAnalysis = await getProposalSentimentAnalysis(proposalId); // Combine proposal data with sentiment analysis return { success: true, data: { ...data.proposal, sentimentAnalysis } }; } catch (sentimentError) { console.error(`Error getting sentiment analysis: ${sentimentError}`); // Return proposal data without sentiment analysis if it fails return { success: true, data: data.proposal }; } } catch (error: any) { return { success: false, error: error.message || `Failed to fetch proposal with ID: ${proposalId}` }; } }