Skip to main content
Glama
tanmay4l
by tanmay4l

createProposal

Submit new proposals for DAOs on Solana's Futarchy protocol by specifying DAO ID, description URL, and liquidity pool token amounts.

Instructions

Create a new proposal for a DAO

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
daoIdYesThe ID of the DAO to create a proposal for
descriptionUrlYesURL to the proposal description
baseTokensToLPYesAmount of base tokens to LP
quoteTokensToLPYesAmount of quote tokens to LP

Implementation Reference

  • Registration of the 'createProposal' MCP tool using server.tool(), including inline input schema and handler function that delegates to apiClient.createProposal.
    server.tool( "createProposal", "Create a new proposal for a DAO", { daoId: z.string().describe("The ID of the DAO to create a proposal for"), descriptionUrl: z.string().describe("URL to the proposal description"), baseTokensToLP: z.number().describe("Amount of base tokens to LP"), quoteTokensToLP: z.number().describe("Amount of quote tokens to LP"), }, async (params) => { try { const response = await apiClient.createProposal({ daoId: params.daoId, descriptionUrl: params.descriptionUrl, baseTokensToLP: params.baseTokensToLP, quoteTokensToLP: params.quoteTokensToLP }); 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 creating proposal: ${error.message || 'Unknown error'}`, }, ], isError: true, }; } } );
  • The async handler function for the 'createProposal' tool, which invokes the API client and formats the MCP response.
    async (params) => { try { const response = await apiClient.createProposal({ daoId: params.daoId, descriptionUrl: params.descriptionUrl, baseTokensToLP: params.baseTokensToLP, quoteTokensToLP: params.quoteTokensToLP }); 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 creating proposal: ${error.message || 'Unknown error'}`, }, ], isError: true, }; } }
  • Zod schema definition for CreateProposalParams, matching the inline schema used in the tool registration. Defines input validation for daoId, descriptionUrl, baseTokensToLP, and quoteTokensToLP.
    export const CreateProposalParamsSchema = z.object({ daoId: z.string().describe("The ID of the DAO to create a proposal for"), descriptionUrl: z.string().describe("URL to the proposal description"), baseTokensToLP: z.number().describe("Amount of base tokens to LP"), quoteTokensToLP: z.number().describe("Amount of quote tokens to LP"), }); export const GetSentimentAnalysisParamsSchema = z.object({ proposalId: z.string().describe("The ID of the proposal to analyze"), }); // Types for params export type GetDaosParams = z.infer<typeof GetDaosParamsSchema>; export type GetDaoParams = z.infer<typeof GetDaoParamsSchema>; export type GetProposalsParams = z.infer<typeof GetProposalsParamsSchema>; export type GetProposalParams = z.infer<typeof GetProposalParamsSchema>; export type CreateProposalParams = z.infer<typeof CreateProposalParamsSchema>;
  • Helper method in FutarchyApiClient that performs the actual HTTP POST request to create a proposal on the backend server.
    async createProposal(params: CreateProposalParams): Promise<Response> { try { const { daoId, descriptionUrl, baseTokensToLP, quoteTokensToLP } = params; const response = await fetch(`${this.baseUrl}/daos/${daoId}/proposals`, { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ descriptionUrl, baseTokensToLP, quoteTokensToLP }) }); if (!response.ok) { throw new Error(`HTTP error! Status: ${response.status}`); } const data = await response.json(); return { success: true, data: data }; } catch (error: any) { return { success: false, error: error.message || 'Failed to create proposal' }; } }

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