get_space_by_id
Retrieve detailed information about a Confluence space using its unique ID. This tool enables efficient management and access to Confluence space data.
Instructions
Get detailed information about a specific Confluence space by ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| spaceId | Yes | Space ID |
Implementation Reference
- src/confluence-client.ts:320-341 (handler)Core handler function that retrieves a Confluence space by ID. Checks cache first, fetches from API if needed, validates space access, caches the result, and returns the space data.async getSpaceById(spaceId: string): Promise<ConfluenceSpace> { // Check if we have this space in cache by ID for (const [key, space] of this.spaceCache.entries()) { if (space.id === spaceId && this.isSpaceCacheValid(key)) { return space; } } // Note: Since we only have access to space keys in configuration, we need to validate by key // This method is primarily for internal use after we've obtained a space ID const response: AxiosResponse<ConfluenceSpace> = await this.client.get(`/spaces/${spaceId}`); // Validate access after getting the space data if (!validateSpaceAccess(response.data.key, this.config.allowedSpaces)) { throw new Error(`Access denied to space: ${response.data.key}`); } // Cache the space this.cacheSpace(response.data); return response.data; }
- src/index.ts:180-193 (registration)Tool registration in the MCP server's list_tools response, including name, description, and input schema definition.{ name: 'get_space_by_id', description: 'Get detailed information about a specific Confluence space by ID', inputSchema: { type: 'object', properties: { spaceId: { type: 'string', description: 'Space ID' } }, required: ['spaceId'] } },
- src/index.ts:391-405 (handler)MCP tool dispatch handler that extracts the spaceId argument, calls the ConfluenceClient.getSpaceById method, and formats the response as MCP content.case 'get_space_by_id': { const { spaceId } = args as { spaceId: string; }; const space = await confluenceClient.getSpaceById(spaceId); return { content: [ { type: 'text', text: JSON.stringify(space, null, 2) } ] }; }
- src/types.ts:42-52 (schema)TypeScript interface defining the structure of a ConfluenceSpace object, used as the return type for getSpaceById.export interface ConfluenceSpace { id: string; key: string; name: string; type: string; status: string; _links: { webui: string; self: string; }; }