Skip to main content
Glama
tanmay4l
by tanmay4l

getProposal

Retrieve a specific proposal by its ID from the Futarchy protocol on Solana to view proposal details and manage DAO governance.

Instructions

Get a specific proposal by ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
proposalIdYesThe ID of the proposal to retrieve

Implementation Reference

  • The MCP server.tool registration and inline handler for the 'getProposal' tool. This executes the tool logic by calling the FutarchyApiClient.getProposal method, handling errors, and formatting the response as MCP content.
    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", 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 proposal: ${error.message || 'Unknown error'}`, }, ], isError: true, }; } });
  • The core helper function in FutarchyApiClient that fetches the proposal data from the backend API endpoint `/proposals/{proposalId}`, augments it with sentiment analysis, and returns a standardized response.
    async getProposal(proposalId) { 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) { return { success: false, error: error.message || `Failed to fetch proposal with ID: ${proposalId}` }; }
  • Zod schema defining the input parameters for the getProposal tool (proposalId: string). Note: Inline schema in handler matches this.
    export const GetProposalParamsSchema = z.object({ proposalId: z.string().describe("The ID of the proposal to retrieve"), });
  • TypeScript declaration for the getProposal method in the API client.
    getProposal(proposalId: string): Promise<Response>;
  • TypeScript declaration exporting the getProposal tool definition.
    export declare const getProposal: ToolDefinition;

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

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