Skip to main content
Glama

getSpaces

Retrieve a list of Snapshot spaces to view governance platforms, with options to limit results or skip entries for efficient browsing.

Instructions

Get list of Snapshot spaces

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoNumber of spaces to fetch
skipNoNumber of spaces to skip

Implementation Reference

  • Core handler function that performs the GraphQL query to fetch paginated list of Snapshot spaces.
    async getSpaces(first: number = 20, skip: number = 0): Promise<Space[]> { const query = ` query Spaces { spaces( first: ${first}, skip: ${skip}, orderBy: "created", orderDirection: asc ) { id name about network symbol strategies { name params } admins members } } `; const result = await this.queryGraphQL(query); return result.spaces; }
  • Zod schema for validating input parameters (limit, skip) for the getSpaces tool.
    const SpacesParamsSchema = z.object({ limit: z.number().optional(), skip: z.number().optional() });
  • src/server.ts:69-79 (registration)
    Tool registration in the listTools handler, defining name, description, and inputSchema.
    { name: "getSpaces", description: "Get list of Snapshot spaces", inputSchema: { // Changed from parameters to inputSchema type: "object", properties: { limit: { type: "number", description: "Number of spaces to fetch" }, skip: { type: "number", description: "Number of spaces to skip" } } } },
  • MCP tool call dispatch handler that validates args, calls the service, and formats response.
    case "getSpaces": { const parsedArgs = SpacesParamsSchema.parse(args); const spaces = await this.snapshotService.getSpaces( parsedArgs.limit || 20, parsedArgs.skip || 0 ); return { content: [{ type: "text", text: JSON.stringify(spaces, null, 2) }] }; }
  • TypeScript interface defining the structure of a Space object returned by getSpaces.
    interface Space { id: string; name: string; about?: string; network?: string; symbol?: string; strategies?: any[]; admins?: string[]; members?: 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/crazyrabbitLTC/mcp-snapshot-server'

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