Skip to main content
Glama

list_spaces

Generate a filtered list of accessible Confluence spaces with pagination support. Configure results limit and cursor for efficient space management.

Instructions

List all accessible Confluence spaces (filtered by allowed spaces)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cursorNoCursor for pagination (from _links.next)
limitNoMaximum results (default: 50)

Implementation Reference

  • MCP tool handler for 'list_spaces' that extracts input parameters, calls ConfluenceClient.listSpaces(), and returns the JSON-formatted result.
    case 'list_spaces': { const { limit = 50, cursor } = args as { limit?: number; cursor?: string; }; const spaces = await confluenceClient.listSpaces(limit, cursor); return { content: [ { type: 'text', text: JSON.stringify(spaces, null, 2) } ] }; }
  • Input schema definition for the list_spaces tool, specifying optional limit and cursor parameters.
    inputSchema: { type: 'object', properties: { limit: { type: 'number', description: 'Maximum results (default: 50)', default: 50 }, cursor: { type: 'string', description: 'Cursor for pagination (from _links.next)' } }
  • src/index.ts:162-179 (registration)
    Registration of the list_spaces tool in the ListToolsRequestSchema handler, including name, description, and input schema.
    { name: 'list_spaces', description: 'List all accessible Confluence spaces (filtered by allowed spaces)', inputSchema: { type: 'object', properties: { limit: { type: 'number', description: 'Maximum results (default: 50)', default: 50 }, cursor: { type: 'string', description: 'Cursor for pagination (from _links.next)' } } } },
  • Helper method in ConfluenceClient that implements the core listSpaces logic: API call to /spaces, filters by allowed spaces, caches results, and returns paginated response.
    async listSpaces(limit = 50, cursor?: string): Promise<PaginatedResult<ConfluenceSpace>> { const params: any = { limit }; if (cursor) { params.cursor = cursor; } const response: AxiosResponse<PaginatedResult<ConfluenceSpace>> = await this.client.get('/spaces', { params }); const filteredResults = response.data.results.filter(space => validateSpaceAccess(space.key, this.config.allowedSpaces) ); // Cache the spaces filteredResults.forEach(space => this.cacheSpace(space)); return { ...response.data, results: filteredResults, size: filteredResults.length }; }

Other Tools

Related Tools

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/Olson3R/confluence-mcp'

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