Skip to main content
Glama

get_space_content

Extract pages from a Confluence space by specifying a space key, with options to set result limits, pagination, and body formats for efficient content retrieval.

Instructions

Get pages from a specific space

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bodyFormatNoBody format to include: "storage" or "view" (optional)
limitNoMaximum results (default: 25)
spaceKeyYesSpace key
startNoStarting index for pagination (default: 0)

Implementation Reference

  • The handler case for 'get_space_content' tool that extracts parameters from the request and calls the ConfluenceClient.getSpaceContent method, returning the result as JSON text content.
    case 'get_space_content': { const { spaceKey, limit = 25, start = 0, bodyFormat } = args as { spaceKey: string; limit?: number; start?: number; bodyFormat?: string; }; const pages = await confluenceClient.getSpaceContent(spaceKey, limit, start, bodyFormat); return { content: [ { type: 'text', text: JSON.stringify(pages, null, 2) } ] }; }
  • The input schema defining parameters for the get_space_content tool, including spaceKey (required), limit, start, and bodyFormat.
    inputSchema: { type: 'object', properties: { spaceKey: { type: 'string', description: 'Space key' }, limit: { type: 'number', description: 'Maximum results (default: 25)', default: 25 }, start: { type: 'number', description: 'Starting index for pagination (default: 0)', default: 0 }, bodyFormat: { type: 'string', description: 'Body format to include: "storage" or "view" (optional)', enum: ['storage', 'view'] } }, required: ['spaceKey'] }
  • src/index.ts:208-236 (registration)
    The tool registration entry in the ListTools response, including name, description, and input schema for get_space_content.
    { name: 'get_space_content', description: 'Get pages from a specific space', inputSchema: { type: 'object', properties: { spaceKey: { type: 'string', description: 'Space key' }, limit: { type: 'number', description: 'Maximum results (default: 25)', default: 25 }, start: { type: 'number', description: 'Starting index for pagination (default: 0)', default: 0 }, bodyFormat: { type: 'string', description: 'Body format to include: "storage" or "view" (optional)', enum: ['storage', 'view'] } }, required: ['spaceKey'] } },
  • The core implementation of getSpaceContent in ConfluenceClient, which fetches pages from a space using the v2 API and optionally enhances with body content from v1 API, including space access validation.
    async getSpaceContent(spaceKey: string, limit = 25, start = 0, bodyFormat?: string): Promise<PaginatedResult<ConfluencePage>> { if (!validateSpaceAccess(spaceKey, this.config.allowedSpaces)) { throw new Error(`Access denied to space: ${spaceKey}`); } // Get basic page list from v2 API const response: AxiosResponse<PaginatedResult<ConfluencePage>> = await this.client.get('/pages', { params: { 'space-key': spaceKey, limit, start } }); // If body content is requested, enhance each page with body content from v1 API if (bodyFormat && response.data.results.length > 0) { const format = bodyFormat === 'view' ? 'body.view' : 'body.storage'; const auth = Buffer.from(`${this.config.username}:${this.config.apiToken}`).toString('base64'); const enhancedResults = await Promise.all( response.data.results.map(async (page) => { try { const v1Url = `${this.config.baseUrl}/wiki/rest/api/content/${page.id}?expand=${format},version,space`; const v1Response = await axios.get(v1Url, { headers: { 'Authorization': `Basic ${auth}`, 'Accept': 'application/json', 'Content-Type': 'application/json' }, timeout: 30000 }); if (v1Response.data.body) { page.body = v1Response.data.body; } } catch (error) { if (this.config.debug) { console.warn(`Failed to retrieve body content for page ${page.id}:`, error); } } return page; }) ); response.data.results = enhancedResults; } return response.data; }

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