get_confluence_space
Retrieve detailed information about a Confluence space by providing its space ID. Returns space metadata such as name, key, and description.
Instructions
Get details about a specific space
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| spaceId | Yes | ID of the space to retrieve |
Implementation Reference
- src/handlers/space-handlers.ts:41-80 (handler)The handler function for the 'get_confluence_space' tool. Takes a ConfluenceClient and args with spaceId, fetches the space via client.getConfluenceSpace(), and returns a simplified response with id, name, key, status, homepage, and url.
export async function handleGetConfluenceSpace( client: ConfluenceClient, args: { spaceId: string } ): Promise<{ content: Array<{ type: "text"; text: string }>; }> { try { if (!args.spaceId) { throw new McpError(ErrorCode.InvalidParams, "spaceId is required"); } const space = await client.getConfluenceSpace(args.spaceId); // Transform to minimal format const simplified = { id: space.id, name: space.name, key: space.key, status: space.status, homepage: space.homepageId, url: space._links.webui }; return { content: [ { type: "text", text: JSON.stringify(simplified), }, ], }; } catch (error) { console.error("Error getting space:", error instanceof Error ? error.message : String(error)); if (error instanceof McpError) { throw error; } throw new McpError( ErrorCode.InternalError, `Failed to get space: ${error instanceof Error ? error.message : String(error)}` ); } } - src/schemas/tool-schemas.ts:19-31 (schema)The input schema for the 'get_confluence_space' tool. Defines a required 'spaceId' string parameter and provides a description.
get_confluence_space: { description: "Get details about a specific space", inputSchema: { type: "object", properties: { spaceId: { type: "string", description: "ID of the space to retrieve", }, }, required: ["spaceId"], }, }, - src/index.ts:202-206 (registration)Registration of the 'get_confluence_space' tool in the main server switch statement. Extracts spaceId from args, validates it, and delegates to handleGetConfluenceSpace.
case "get_confluence_space": { const { spaceId } = (args || {}) as { spaceId: string }; if (!spaceId) throw new McpError(ErrorCode.InvalidParams, "spaceId is required"); return await handleGetConfluenceSpace(this.confluenceClient, { spaceId }); } - The helper/client method getConfluenceSpace() that makes the actual API call to fetch a space by ID from Confluence's v2 API.
async getConfluenceSpace(spaceId: string): Promise<Space> { const response = await this.v2Client.get(`/spaces/${spaceId}`); return response.data; } - src/index.ts:31-31 (registration)Import of handleGetConfluenceSpace from space-handlers into the main server file.
import { handleGetConfluenceSpace, handleListConfluenceSpaces } from "./handlers/space-handlers.js";