createProposal
Submit a new proposal for a DAO on the Futarchy protocol by specifying the DAO ID, proposal description URL, and token amounts for liquidity provision. Simplifies DAO governance on Solana.
Instructions
Create a new proposal for a DAO
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| baseTokensToLP | Yes | Amount of base tokens to LP | |
| daoId | Yes | The ID of the DAO to create a proposal for | |
| descriptionUrl | Yes | URL to the proposal description | |
| quoteTokensToLP | Yes | Amount of quote tokens to LP |
Implementation Reference
- src/mcp/server/index.ts:239-279 (handler)MCP tool handler for 'createProposal' that delegates to FutarchyApiClient.createProposal and formats the response as MCP-standard content with error handling.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, }; } }
- src/mcp/server/index.ts:230-279 (registration)Registration of the 'createProposal' tool on the MCP server using server.tool, including description, inline input schema, and handler function.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, }; } }
- src/mcp/common/types.ts:71-87 (schema)Zod schema definition and TypeScript type for CreateProposalParams used in the tool and API client.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>;
- src/mcp/common/api.ts:112-143 (helper)FutarchyApiClient method that proxies the createProposal request via HTTP POST to the backend API endpoint.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' }; } }