get_space_by_key
Retrieve detailed information about a specific Confluence space using its unique key. Ideal for managing and organizing Confluence spaces efficiently.
Instructions
Get detailed information about a specific Confluence space by key
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| spaceKey | Yes | Space key |
Implementation Reference
- src/index.ts:407-421 (handler)MCP tool handler for 'get_space_by_key': extracts spaceKey argument, calls ConfluenceClient.getSpaceByKey(), and returns the space object as formatted JSON text content.case 'get_space_by_key': { const { spaceKey } = args as { spaceKey: string; }; const space = await confluenceClient.getSpaceByKey(spaceKey); return { content: [ { type: 'text', text: JSON.stringify(space, null, 2) } ] }; }
- src/index.ts:194-207 (schema)Tool schema definition including name, description, and input schema requiring 'spaceKey' string.{ name: 'get_space_by_key', description: 'Get detailed information about a specific Confluence space by key', inputSchema: { type: 'object', properties: { spaceKey: { type: 'string', description: 'Space key' } }, required: ['spaceKey'] } },
- src/confluence-client.ts:354-394 (helper)Core implementation of getSpaceByKey in ConfluenceClient: validates space access, checks/uses cache, paginates listSpaces to find matching space by key, handles caching, and returns ConfluenceSpace.async getSpaceByKey(spaceKey: string): Promise<ConfluenceSpace> { if (!validateSpaceAccess(spaceKey, this.config.allowedSpaces)) { throw new Error(`Access denied to space: ${spaceKey}`); } // Check cache first if (this.isSpaceCacheValid(spaceKey)) { const cachedSpace = this.spaceCache.get(spaceKey); if (cachedSpace) { return cachedSpace; } } // Search through all pages using cursor-based pagination let cursor: string | undefined; let found = false; let space: ConfluenceSpace | undefined; do { const spaces = await this.listSpaces(100, cursor); space = spaces.results.find(s => s.key === spaceKey); if (space) { found = true; break; } // Extract cursor from _links.next if available cursor = undefined; if (spaces._links?.next) { const nextUrl = new URL(spaces._links.next); cursor = nextUrl.searchParams.get('cursor') || undefined; } } while (cursor); if (!found || !space) { throw new Error(`Space not found: ${spaceKey}`); } return space; }