Skip to main content
Glama
itshare4u

Agent Knowledge MCP

server_status

Check server status, version, and system information to monitor health and identify available updates for maintenance.

Instructions

Check current server status, version, and available updates with comprehensive system information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
check_updatesNoCheck for available updates from PyPI

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Main handler for 'server_status' tool. Checks server version (multiple sources), installation method (uvx detection), PyPI updates via requests, Elasticsearch config, and provides comprehensive formatted status report with recommendations.
    @app.tool(
        description="Check current server status, version, and available updates with comprehensive system information",
        tags={"admin", "server", "status", "version", "updates"}
    )
    async def server_status(
        check_updates: Annotated[bool, Field(description="Check for available updates from PyPI")] = True
    ) -> str:
        """Check comprehensive server status including version, installation method, and update availability."""
        try:
            # Get current version with multiple fallback methods
            current_version = "unknown"
            version_source = "fallback"
    
            try:
                # Method 1: Standard package metadata (for uvx installs)
                import importlib.metadata
                current_version = importlib.metadata.version("agent-knowledge-mcp")
                version_source = "importlib.metadata"
            except Exception:
                # Method 2: Local module version (for development)
                try:
                    from . import __version__
                    current_version = __version__
                    version_source = "local module"
                except ImportError:
                    try:
                        from src import __version__
                        current_version = __version__
                        version_source = "src module"
                    except ImportError:
                        # Keep fallback
                        pass
    
            # Get current configuration
            config = load_config()
            server_status = "running"
    
            # Detect installation method with comprehensive checking
            installation_method = "unknown"
            installation_details = ""
    
            try:
                # Check if installed via uvx (UV tool management)
                result = subprocess.run(
                    ["uv", "tool", "list"],
                    capture_output=True,
                    text=True,
                    timeout=10
                )
                if result.returncode == 0 and "agent-knowledge-mcp" in result.stdout:
                    installation_method = "uvx"
                    installation_details = "Installed via UV tool management"
                elif result.returncode == 0:
                    installation_method = "development"
                    installation_details = "Running in development mode"
                else:
                    installation_method = "other"
                    installation_details = "Non-uvx installation detected"
            except FileNotFoundError:
                installation_method = "no-uv"
                installation_details = "UV not found - likely pip install or development"
            except subprocess.TimeoutExpired:
                installation_method = "timeout"
                installation_details = "UV tool check timed out"
            except Exception as e:
                installation_method = "error"
                installation_details = f"Error checking: {str(e)}"
    
            # Check for updates with comprehensive PyPI integration
            latest_version = None
            update_available = False
            update_check_status = "not_checked"
            recommendation = ""
    
            if check_updates:
                try:
                    import requests
                    response = requests.get(
                        "https://pypi.org/pypi/agent-knowledge-mcp/json",
                        timeout=5
                    )
                    if response.status_code == 200:
                        data = response.json()
                        latest_version = data["info"]["version"]
                        update_check_status = "success"
    
                        # Enhanced version comparison
                        if latest_version != current_version and current_version != "unknown":
                            update_available = True
                            if installation_method == "uvx":
                                recommendation = f"šŸ”„ **Update Available!** Version {latest_version} ready\n   šŸ’” Use server_upgrade tool to update automatically"
                            else:
                                recommendation = f"šŸ”„ **Update Available!** Version {latest_version} ready\n   āš ļø Manual update required (not uvx installation)"
                        elif current_version == "unknown":
                            recommendation = f"šŸ“¦ Latest version: {latest_version}\n   āš ļø Cannot compare - current version unknown"
                    else:
                        update_check_status = f"http_error_{response.status_code}"
                        latest_version = f"HTTP {response.status_code} error"
                except ImportError:
                    update_check_status = "missing_requests"
                    latest_version = "requests module not available"
                except requests.exceptions.Timeout:
                    update_check_status = "timeout"
                    latest_version = "PyPI request timed out"
                except requests.exceptions.ConnectionError:
                    update_check_status = "connection_error"
                    latest_version = "No internet connection"
                except Exception as e:
                    update_check_status = "error"
                    latest_version = f"Error: {str(e)}"
            else:
                update_check_status = "skipped"
                latest_version = "Update check disabled"
    
            # Build comprehensive status message
            message = "šŸ–„ļø **Server Status Report**\n\n"
    
            # Version information
            message += f"šŸ“ **Version Information:**\n"
            message += f"   šŸ·ļø Current Version: {current_version}\n"
            message += f"   šŸ“– Version Source: {version_source}\n"
            if latest_version:
                message += f"   šŸ“¦ Latest Version: {latest_version}\n"
                message += f"   šŸ” Update Check: {update_check_status}\n"
    
            # Installation details
            message += f"\nšŸ”§ **Installation Information:**\n"
            message += f"   šŸ“„ Method: {installation_method}\n"
            message += f"   šŸ“ Details: {installation_details}\n"
    
            # System status
            message += f"\n⚔ **System Status:**\n"
            message += f"   šŸš€ Server: {server_status}\n"
            message += f"   šŸ—‚ļø Elasticsearch: {config['elasticsearch']['host']}:{config['elasticsearch']['port']}\n"
    
            # Configuration summary
            if "server" in config:
                server_config = config["server"]
                message += f"   šŸ“› Server Name: {server_config.get('name', 'AgentKnowledgeMCP')}\n"
                message += f"   šŸ·ļø Config Version: {server_config.get('version', '1.0.0')}\n"
    
            # Update recommendations
            if update_available and recommendation:
                message += f"\n✨ **Update Available:**\n   {recommendation}\n"
            elif check_updates and not update_available and update_check_status == "success":
                message += f"\nāœ… **System Up to Date:**\n   You are running the latest version!\n"
    
            # Installation method guidance
            if installation_method not in ["uvx"]:
                message += f"\nšŸ’” **Management Tools Notice:**\n"
                message += f"   āš ļø Server management tools (upgrade) require uvx installation\n"
                message += f"   šŸ› ļø Install via: `uvx install agent-knowledge-mcp`\n"
                message += f"   šŸ“š Current method ({installation_method}) has limited management capabilities\n"
    
            return message
    
        except ImportError as e:
            return f"āŒ Module Error: Missing required dependency\nšŸ” Details: {str(e)}\nšŸ’” Some status features require additional modules (requests for update checks)"
        except subprocess.TimeoutExpired:
            return f"āŒ Timeout Error: System command timed out\nšŸ’” Installation method detection failed - try again or check system performance"
        except Exception as e:
            return _format_admin_error(e, "check server status", "version detection and update checking")
  • Mounting of admin_server_app into main FastMCP server, registering admin tools including server_status (with backward compatibility aliases mentioned).
    # Mount Administrative operations server with 'admin' prefix
    # This provides: admin_get_config, admin_update_config, admin_server_status, etc.
    app.mount(admin_server_app)
  • CLI print statement listing 'server_status' as one of the available tools from Admin server.
    print("    └─ Tools: get_config, update_config, server_status, server_upgrade, setup_elasticsearch, elasticsearch_status, validate_config, reset_config, reload_config")
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 mentions what information is returned but doesn't describe important traits like whether this is a read-only operation (implied but not stated), whether it requires authentication, potential rate limits, or what 'comprehensive system information' includes. For a tool with no annotation coverage, this leaves significant behavioral gaps.

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

Conciseness5/5

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

The description is a single, efficient sentence that front-loads the core purpose. Every word contributes meaning without redundancy. It's appropriately sized for a simple status-checking tool with one optional parameter.

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

Completeness4/5

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

Given the tool's low complexity (1 optional parameter), 100% schema coverage, and the presence of an output schema (which means the description doesn't need to explain return values), the description is reasonably complete. It clearly states what the tool does and what information it provides. The main gap is the lack of behavioral context, but the output schema helps compensate for this.

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

Parameters3/5

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

The input schema has 100% description coverage, with the single parameter 'check_updates' clearly documented in the schema. The description doesn't add any parameter-specific information beyond what's already in the schema. According to the rules, when schema_description_coverage is high (>80%), the baseline is 3 even with no param info in the description.

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 with specific verbs ('check', 'get') and resources ('server status', 'version', 'available updates', 'system information'). It distinguishes from obvious siblings like 'elasticsearch_status' by focusing on the server itself rather than a specific component. However, it doesn't explicitly differentiate from all potential status-related tools in the list.

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 no guidance on when to use this tool versus alternatives. There's no mention of prerequisites, timing considerations, or comparison to similar tools like 'elasticsearch_status' or 'get_config'. The agent must infer usage context solely from the tool name and description.

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/itshare4u/AgentKnowledgeMCP'

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