getDaos
Retrieve all DAOs from the Futarchy protocol on Solana to manage decentralized organizations and proposals.
Instructions
Get all DAOs from the Futarchy system
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/mcp/server/index.ts:56-96 (handler)MCP server tool registration including the handler function for 'getDaos'. The handler invokes apiClient.getDaos(), processes the response, and returns formatted JSON or error text.server.tool( "getDaos", "Get all DAOs from the Futarchy system", {}, async () => { try { const response = await apiClient.getDaos(); 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 DAOs: ${error.message || 'Unknown error'}`, }, ], isError: true, }; } } );
- src/mcp/common/api.ts:16-34 (helper)Core implementation of getDaos method in FutarchyApiClient. Performs HTTP GET to backend /daos endpoint and wraps response in standardized Response format.async getDaos(): Promise<Response> { try { const response = await fetch(`${this.baseUrl}/daos`); if (!response.ok) { throw new Error(`HTTP error! Status: ${response.status}`); } const data = await response.json(); return { success: true, data: data.daos }; } catch (error: any) { return { success: false, error: error.message || 'Failed to fetch DAOs' }; } }
- src/mcp/common/types.ts:57-57 (schema)Zod schema defining input parameters for getDaos tool (empty object, no parameters required).export const GetDaosParamsSchema = z.object({});
- src/mcp/server/index.ts:56-96 (registration)Explicit registration of the 'getDaos' tool on the MCP server with name, description, input schema, and handler function.server.tool( "getDaos", "Get all DAOs from the Futarchy system", {}, async () => { try { const response = await apiClient.getDaos(); 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 DAOs: ${error.message || 'Unknown error'}`, }, ], isError: true, }; } } );