Skip to main content
Glama

MPC Tally API Server

listProposals.ts1.4 kB
import { GraphQLClient } from 'graphql-request'; import { LIST_PROPOSALS_QUERY } from './proposals.queries.js'; import { getDAO } from '../organizations/getDAO.js'; import type { ProposalsInput, ProposalsResponse, ListProposalsParams } from './listProposals.types.js'; export async function listProposals( client: GraphQLClient, params: ListProposalsParams ): Promise<ProposalsResponse> { try { // Get the DAO first to get its ID const { organization: dao } = await getDAO(client, params.slug); const apiInput: ProposalsInput = { filters: { organizationId: dao.id, includeArchived: params.includeArchived, isDraft: params.isDraft }, page: { limit: params.limit || 50, // Default to maximum afterCursor: params.afterCursor, beforeCursor: params.beforeCursor }, ...(typeof params.isDescending === 'boolean' && { sort: { isDescending: params.isDescending, sortBy: "id" } }) }; const response = await client.request<ProposalsResponse>(LIST_PROPOSALS_QUERY, { input: apiInput }); if (!response?.proposals?.nodes) { throw new Error('Invalid response structure from API'); } return response; } catch (error) { throw new Error(`Failed to fetch proposals: ${error instanceof Error ? error.message : 'Unknown error'}`); } }

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/crazyrabbitLTC/mpc-tally-api-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server