get_confluence_space
Retrieve detailed information about a specific Confluence space by providing its unique ID to access space configurations and content structure.
Instructions
Get details about a specific space
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| spaceId | Yes | ID of the space to retrieve |
Implementation Reference
- src/handlers/space-handlers.ts:41-80 (handler)The main handler function for the 'get_confluence_space' tool. It validates the spaceId, fetches the space using the ConfluenceClient, simplifies the response, and returns it as JSON text content.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 and description for the 'get_confluence_space' tool, defining the required 'spaceId' parameter.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 and dispatching of the 'get_confluence_space' tool in the main server request handler switch statement, which calls the handler function.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 ConfluenceClient helper method that performs the actual API call to retrieve a specific space by ID.async getConfluenceSpace(spaceId: string): Promise<Space> { const response = await this.v2Client.get(`/spaces/${spaceId}`); return response.data; }
- src/index.ts:31-31 (registration)Import statement registering the handler function for use in the main server.import { handleGetConfluenceSpace, handleListConfluenceSpaces } from "./handlers/space-handlers.js";