Skip to main content
Glama
stevereiner
by stevereiner

get_repository_info_tool

Retrieve repository information from Alfresco content management systems to access metadata and configuration details for content operations.

Instructions

Get Alfresco repository information using Discovery Client (as tool instead of resource).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Handler function for the 'get_repository_info_tool' MCP tool. Decorated with @mcp.tool for registration and execution. Delegates to the core implementation function.
    @mcp.tool
    async def get_repository_info_tool(ctx: Context = None) -> str:
        """Get Alfresco repository information using Discovery Client (as tool instead of resource)."""
        return await get_repository_info_impl()
  • Core implementation logic for retrieving Alfresco repository information via Discovery API. Handles connection, API calls, error cases (e.g., disabled Discovery), and formats comprehensive output including version, license, modules, and status.
    async def get_repository_info_impl() -> str:
        """Get Alfresco repository information using Discovery API.
        Returns comprehensive repository details or connection status.
        """
        try:
            await ensure_connection()
            client_factory: ClientFactory = await get_client_factory()
            
            logger.info("Getting repository information via Discovery API")
            
            # Use the working pattern from test script - high-level API
            discovery_client = client_factory.create_discovery_client()
            
            # Check if discovery client has the discovery attribute (working pattern from test)
            if not hasattr(discovery_client, 'discovery'):
                logger.warning("Discovery client does not have discovery attribute")
                return safe_format_output(f"""āš ļø **Repository Information - Discovery Client Unavailable**
    
    **Status**: Discovery client initialization failed
    
    **Available Information**:
    šŸ”— **Server**: {os.getenv('ALFRESCO_URL', 'http://localhost:8080')}
    šŸ‘¤ **Connected as**: {os.getenv('ALFRESCO_USERNAME', 'admin')}
    āŒ **Discovery API**: Client not available
    
    **Note**: This could indicate:
    - Authentication issues
    - Network connectivity problems
    - Server configuration issues
    
    **Recommendation**: Check connection settings and server status.""")
            
            # Get repository information using high-level Discovery API (working pattern from test)
            repo_info = discovery_client.discovery.get_repository_information()
            
            # Handle None response (HTTP 501 - Discovery API disabled)
            if repo_info is None:
                logger.warning("Discovery API is disabled on this Alfresco instance (returned None)")
                return safe_format_output(f"""āš ļø **Repository Information - Discovery API Disabled**
    
    **Status**: Discovery API is disabled on this Alfresco instance (HTTP 501)
    
    **Available Information**:
    šŸ”— **Server**: {os.getenv('ALFRESCO_URL', 'http://localhost:8080')}
    šŸ‘¤ **Connected as**: {os.getenv('ALFRESCO_USERNAME', 'admin')}
    āœ… **Core API**: Available (connection successful)
    āŒ **Discovery API**: Disabled by administrator
    
    **Note**: The Discovery API provides detailed repository information including:
    - Version and edition details
    - License information and entitlements  
    - Installed modules and their versions
    - Repository status and capabilities
    
    **Administrator Action Required**: To enable Discovery API, the Alfresco administrator needs to:
    1. Enable the Discovery API in the repository configuration
    2. Restart the Alfresco service
    3. Ensure proper permissions are configured
    
    **Alternative**: Use Core API tools for basic repository operations.""")
            
            if repo_info and hasattr(repo_info, 'entry'):
                entry = repo_info.entry
                repository = getattr(entry, 'repository', {})
                
                # Build comprehensive repository information
                result = "šŸ¢ **Alfresco Repository Information**\n\n"
                
                # Repository ID and Edition
                repo_id = getattr(repository, 'id', 'Unknown')
                edition = getattr(repository, 'edition', 'Unknown')
                logger.info(f"āœ… Retrieved repository info: {edition} edition")
                result += f"šŸ†” **Repository ID**: {repo_id}\n"
                result += f"šŸ·ļø **Edition**: {edition}\n\n"
                
                # Version Information
                version_info = getattr(repository, 'version', {})
                if hasattr(version_info, 'major'):
                    result += "šŸ“¦ **Version Details**:\n"
                    result += f"   • Major: {getattr(version_info, 'major', 'Unknown')}\n"
                    result += f"   • Minor: {getattr(version_info, 'minor', 'Unknown')}\n"
                    result += f"   • Patch: {getattr(version_info, 'patch', 'Unknown')}\n"
                    result += f"   • Hotfix: {getattr(version_info, 'hotfix', 'Unknown')}\n"
                    result += f"   • Schema: {getattr(version_info, 'schema', 'Unknown')}\n"
                    result += f"   • Label: {getattr(version_info, 'label', 'Unknown')}\n"
                    result += f"   • Display: {getattr(version_info, 'display', 'Unknown')}\n\n"
                
                # Repository Status
                status_info = getattr(repository, 'status', {})
                if hasattr(status_info, 'is_read_only'):
                    result += "STATUS **Repository Status**:\n"
                    result += f"   • Read Only: {'Yes' if getattr(status_info, 'is_read_only', False) else 'No'}\n"
                    result += f"   • Audit Enabled: {'Yes' if getattr(status_info, 'is_audit_enabled', False) else 'No'}\n"
                    result += f"   • Quick Share Enabled: {'Yes' if getattr(status_info, 'is_quick_share_enabled', False) else 'No'}\n"
                    result += f"   • Thumbnail Generation: {'Yes' if getattr(status_info, 'is_thumbnail_generation_enabled', False) else 'No'}\n\n"
                
                # License Information
                license_info = getattr(repository, 'license', {})
                if hasattr(license_info, 'issued_at'):
                    result += "šŸ“„ **License Information**:\n"
                    result += f"   • Issued At: {getattr(license_info, 'issued_at', 'Unknown')}\n"
                    result += f"   • Expires At: {getattr(license_info, 'expires_at', 'Unknown')}\n"
                    result += f"   • Remaining Days: {getattr(license_info, 'remaining_days', 'Unknown')}\n"
                    result += f"   • Holder: {getattr(license_info, 'holder', 'Unknown')}\n"
                    result += f"   • Mode: {getattr(license_info, 'mode', 'Unknown')}\n"
                    
                    # License Entitlements
                    entitlements = getattr(license_info, 'entitlements', {})
                    if hasattr(entitlements, 'max_users'):
                        result += f"   • Max Users: {getattr(entitlements, 'max_users', 'Unknown')}\n"
                        result += f"   • Max Documents: {getattr(entitlements, 'max_docs', 'Unknown')}\n"
                        result += f"   • Cluster Enabled: {'Yes' if getattr(entitlements, 'is_cluster_enabled', False) else 'No'}\n"
                        result += f"   • Cryptodoc Enabled: {'Yes' if getattr(entitlements, 'is_cryptodoc_enabled', False) else 'No'}\n"
                    result += "\n"
                
                # Modules Information
                modules = getattr(repository, 'modules', [])
                if modules and len(modules) > 0:
                    result += f"🧩 **Installed Modules** ({len(modules)} total):\n"
                    for i, module in enumerate(modules[:10], 1):  # Show first 10 modules
                        module_id = getattr(module, 'id', 'Unknown')
                        module_title = getattr(module, 'title', 'Unknown')
                        module_version = getattr(module, 'version', 'Unknown')
                        module_state = getattr(module, 'install_state', 'Unknown')
                        result += f"   {i}. **{module_title}** (ID: {module_id})\n"
                        result += f"      • Version: {module_version}\n"
                        result += f"      • State: {module_state}\n"
                        
                        install_date = getattr(module, 'install_date', None)
                        if install_date:
                            result += f"      • Installed: {install_date}\n"
                        result += "\n"
                    
                    if len(modules) > 10:
                        result += f"   *... and {len(modules) - 10} more modules*\n\n"
                
                # Connection Details
                result += "šŸ”— **Connection Details**:\n"
                result += f"   • Server: {os.getenv('ALFRESCO_URL', 'http://localhost:8080')}\n"
                result += f"   • Connected as: {os.getenv('ALFRESCO_USERNAME', 'admin')}\n"
                result += f"   • Data Source: Discovery API (High-Level)\n"
                
                return safe_format_output(result)
            
        except Exception as discovery_error:
            error_str = str(discovery_error)
            
            # Check if Discovery API is disabled (501 error)
            if "501" in error_str or "Discovery is disabled" in error_str:
                logger.warning("Discovery API is disabled on this Alfresco instance")
                return safe_format_output(f"""WARNING: **Repository Information - Discovery API Disabled**
    
    **Status**: Discovery API is disabled on this Alfresco instance (HTTP 501)
    
    **Available Information**:
    šŸ”— **Server**: {os.getenv('ALFRESCO_URL', 'http://localhost:8080')}
    šŸ‘¤ **Connected as**: {os.getenv('ALFRESCO_USERNAME', 'admin')}
    āœ… **Core API**: Available (connection successful)
    āŒ **Discovery API**: Disabled by administrator
    
    **Note**: The Discovery API provides detailed repository information including:
    - Version and edition details
    - License information and entitlements  
    - Installed modules and their versions
    - Repository status and capabilities
    
    **Administrator Action Required**: To enable Discovery API, the Alfresco administrator needs to:
    1. Enable the Discovery API in the repository configuration
    2. Restart the Alfresco service
    3. Ensure proper permissions are configured
    
    **Alternative**: Use Core API tools for basic repository operations.""")
            else:
                # Other Discovery API errors
                logger.error(f"Discovery API failed: {error_str}")
                return safe_format_output(f"""ERROR: **Repository Information Unavailable**
    
    **Error**: Discovery API failed
    **Details**: {error_str}
    
    šŸ”— **Server**: {os.getenv('ALFRESCO_URL', 'http://localhost:8080')}
    šŸ‘¤ **Connected as**: {os.getenv('ALFRESCO_USERNAME', 'admin')}
    
    **Possible Causes**:
    - Discovery API endpoint not available
    - Insufficient permissions
    - Network connectivity issues
    - Repository service issues
    **Recommendation**: Check server logs and verify Discovery API availability.""")
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states this is a 'get' operation which implies read-only behavior, but doesn't specify authentication requirements, rate limits, error conditions, or what specific repository information is returned. The mention of Discovery Client adds some implementation context but doesn't sufficiently describe operational behavior for a tool with no annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately concise at one sentence that directly states the tool's purpose and implementation approach. It's front-loaded with the core functionality ('Get Alfresco repository information') and adds useful context about the Discovery Client. There's no wasted verbiage, though it could be slightly more structured for better readability.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has zero parameters, 100% schema coverage, and an output schema exists, the description's job is simplified. However, as a read operation among many repository tools with no annotations, it should better explain what distinguishes it from siblings and what specific information is returned. The presence of an output schema reduces the need to describe return values, but the description could provide more context about when this tool is the appropriate choice.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters, and schema description coverage is 100%. The description appropriately doesn't waste space discussing non-existent parameters. A baseline of 4 is appropriate for parameterless tools where the schema fully documents the empty parameter set, and the description focuses on the tool's purpose rather than parameter details.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Get Alfresco repository information' specifies both the verb (get) and resource (repository information). It distinguishes from siblings by mentioning the Discovery Client approach, though it doesn't explicitly differentiate from similar read operations like get_node_properties. The purpose is clear but could better highlight uniqueness among sibling tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides minimal usage guidance. It mentions using 'Discovery Client (as tool instead of resource)' which hints at architectural context, but doesn't specify when to use this tool versus alternatives like browse_repository or get_node_properties. No explicit when/when-not scenarios or prerequisites are provided, leaving the agent with little guidance on appropriate usage contexts.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/stevereiner/python-alfresco-mcp-server'

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