Skip to main content
Glama
tanmay4l

Futarchy MCP Server

by tanmay4l

sellInPassMarket

Sell tokens in a proposal's pass market to manage DAO investments on Solana. Execute trades based on market predictions for proposal outcomes.

Instructions

Sell tokens in the pass market for a proposal

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
proposalIdYesThe ID of the proposal to trade in
amountYesAmount to sell
userYesUser's public key

Implementation Reference

  • MCP server tool registration for 'sellInPassMarket', including input schema (Zod) and handler function that proxies to FutarchyApiClient
    server.tool(
      "sellInPassMarket",
      "Sell tokens in the pass market for a proposal",
      {
        proposalId: z.string().describe("The ID of the proposal to trade in"),
        amount: z.number().describe("Amount to sell"),
        user: z.string().describe("User's public key"),
      },
      async ({ proposalId, amount, user }) => {
        try {
          const response = await apiClient.sellInPassMarket(proposalId, amount, user);
          
          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 selling in pass market: ${error.message || 'Unknown error'}`,
              },
            ],
            isError: true,
          };
        }
      }
    );
  • FutarchyApiClient method that implements the sellInPassMarket API call to the backend server endpoint /proposals/{proposalId}/sell-pass
    async sellInPassMarket(proposalId: string, amount: number, userPublicKey: string): Promise<Response> {
      try {
        const response = await fetch(`${this.baseUrl}/proposals/${proposalId}/sell-pass`, {
          method: 'POST',
          headers: {
            'Content-Type': 'application/json',
          },
          body: JSON.stringify({
            amount,
            user: userPublicKey
          })
        });
    
        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 sell in pass market'
        };
      }
    }
  • Zod input schema for the sellInPassMarket MCP tool
    {
      proposalId: z.string().describe("The ID of the proposal to trade in"),
      amount: z.number().describe("Amount to sell"),
      user: z.string().describe("User's public key"),
    },
  • Helper script defining simplified parameter types for backend routes integration
    "mcp_futarchy_routes_sellInPassMarket": {
      "proposalId": "string",
      "amount": "number",
      "user": "string"
    },
    "mcp_futarchy_routes_buyInFailMarket": {
      "proposalId": "string",
      "amount": "number",
      "user": "string"
    },
    "mcp_futarchy_routes_sellInFailMarket": {
      "proposalId": "string",
      "amount": "number",
      "user": "string"
    }

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