Skip to main content
Glama
Olson3R
by Olson3R

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
NameRequiredDescriptionDefault
spaceIdYesSpace ID

Implementation Reference

  • 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']
      }
    },
  • 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)
          }
        ]
      };
    }
  • 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;
      };
    }
Install Server

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Olson3R/confluence-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server