list_confluence_spaces
Retrieve Confluence space IDs, names, and keys to begin content discovery workflows. Use this tool first to identify available spaces for further operations.
Instructions
List all available Confluence spaces. Best used as the first step in a content discovery workflow. Returns space IDs, names, and keys that you can use with other tools. TIP: Use a higher limit (e.g., 100) on first call to get a comprehensive view of available spaces.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum number of spaces to return (default: 25) | |
| start | No | Starting index for pagination (default: 0) |
Implementation Reference
- src/handlers/space-handlers.ts:6-39 (handler)The handler function that executes the list_confluence_spaces tool logic. It fetches spaces from the Confluence client, simplifies the response, and formats it as MCP text content.export async function handleListConfluenceSpaces( client: ConfluenceClient, args: { limit?: number; start?: number } ): Promise<{ content: Array<{ type: "text"; text: string }>; }> { try { const spaces = await client.getConfluenceSpaces(args.limit, args.start); // Transform to minimal format const simplified = { results: spaces.results.map(space => ({ id: space.id, name: space.name, key: space.key, status: space.status })), next: spaces._links.next ? true : false }; return { content: [ { type: "text", text: JSON.stringify(simplified), }, ], }; } catch (error) { console.error("Error listing spaces:", error instanceof Error ? error.message : String(error)); throw new McpError( ErrorCode.InternalError, `Failed to list spaces: ${error instanceof Error ? error.message : String(error)}` ); } }
- src/schemas/tool-schemas.ts:2-17 (schema)The input schema and description definition for the list_confluence_spaces tool.list_confluence_spaces: { description: "List all available Confluence spaces. Best used as the first step in a content discovery workflow. Returns space IDs, names, and keys that you can use with other tools. TIP: Use a higher limit (e.g., 100) on first call to get a comprehensive view of available spaces.", inputSchema: { type: "object", properties: { limit: { type: "number", description: "Maximum number of spaces to return (default: 25)", }, start: { type: "number", description: "Starting index for pagination (default: 0)", }, }, }, },
- src/index.ts:198-200 (registration)The switch case in the main tool request handler that registers and calls the list_confluence_spaces tool implementation.case "list_confluence_spaces": { const { limit, start } = (args || {}) as { limit?: number; start?: number }; return await handleListConfluenceSpaces(this.confluenceClient, { limit, start });