Skip to main content
Glama
tanmay4l

Futarchy MCP Server

by tanmay4l

getDao

Retrieve a specific DAO by its ID from the Futarchy protocol on Solana to access governance information and manage proposals.

Instructions

Get a specific DAO by ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
daoIdYesThe ID of the DAO to retrieve

Implementation Reference

  • MCP tool handler implementation for 'getDao'. Validates input, fetches DAO data using apiClient, handles success/error responses, and returns markdown-compatible content.
    server.tool(
      "getDao",
      "Get a specific DAO by ID",
      {
        daoId: z.string().describe("The ID of the DAO to retrieve"),
      },
      async ({ daoId }) => {
        try {
          const response = await apiClient.getDao(daoId);
          
          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 DAO: ${error.message || 'Unknown error'}`,
              },
            ],
            isError: true,
          };
        }
      }
  • Core helper method in FutarchyApiClient that performs HTTP GET request to backend API endpoint `/daos/{daoId}` to retrieve specific DAO information.
    async getDao(daoId: string): Promise<Response> {
      try {
        const response = await fetch(`${this.baseUrl}/daos/${daoId}`);
        if (!response.ok) {
          throw new Error(`HTTP error! Status: ${response.status}`);
        }
        const data = await response.json();
        
        return {
          success: true,
          data: data.dao
        };
      } catch (error: any) {
        return {
          success: false,
          error: error.message || `Failed to fetch DAO with ID: ${daoId}`
        };
      }
    }
  • Zod schema defining input parameters for getDao tool (matches inline schema in handler).
    export const GetDaoParamsSchema = z.object({
      daoId: z.string().describe("The ID of the DAO to retrieve"),
    });
  • TypeScript type and Zod schema for DAO data structure returned by the tool.
    export const DaoSchema = z.object({
      address: z.string(),
      tokenMint: z.string(),
      usdcMint: z.string(),
      // Add other DAO fields as needed
    });
    
    export type Dao = z.infer<typeof DaoSchema>;

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