Skip to content

mcp_registry_client.commands.info

Info command implementation.

InfoCommand

Bases: BaseCommand

Command to get detailed information about a specific server.

Source code in mcp_registry_client/commands/info.py
class InfoCommand(BaseCommand):
    """Command to get detailed information about a specific server."""

    def __init__(self, args: argparse.Namespace) -> None:
        """Initialize info command.

        Args:
            args: Parsed command line arguments containing 'server_name' and 'json'

        """
        super().__init__(args)

    def validate_args(self) -> None:
        """Validate info command arguments.

        Raises:
            ValueError: If server name is invalid

        """
        validate_server_name(self.args.server_name)

    async def execute(self) -> Server:
        """Execute the info command.

        Returns:
            Server information from the registry client

        Raises:
            RegistryAPIError: If API request fails
            RegistryClientError: If client processing fails
            httpx.RequestError: If HTTP request fails
            ValidationError: If response validation fails
            ValueError: If server is not found

        """
        async with RegistryClient() as client:
            server = await client.get_server_by_name(self.args.server_name)

            if server is None:
                msg = f'Server "{self.args.server_name}" not found'
                raise ValueError(msg)

            return server

    def format_output(self, result: Server) -> None:
        """Format and display server information.

        Args:
            result: Server object with detailed information

        """
        cli_config = get_cli_config()

        if self.args.json:
            data = format_server_detailed(result)
            print_json(data, indent=cli_config.json_indent)
        else:
            print_server_info_human_readable(result)

__init__(args)

Initialize info command.

Parameters:

Name Type Description Default
args Namespace

Parsed command line arguments containing 'server_name' and 'json'

required
Source code in mcp_registry_client/commands/info.py
def __init__(self, args: argparse.Namespace) -> None:
    """Initialize info command.

    Args:
        args: Parsed command line arguments containing 'server_name' and 'json'

    """
    super().__init__(args)

execute() async

Execute the info command.

Returns:

Type Description
Server

Server information from the registry client

Raises:

Type Description
RegistryAPIError

If API request fails

RegistryClientError

If client processing fails

RequestError

If HTTP request fails

ValidationError

If response validation fails

ValueError

If server is not found

Source code in mcp_registry_client/commands/info.py
async def execute(self) -> Server:
    """Execute the info command.

    Returns:
        Server information from the registry client

    Raises:
        RegistryAPIError: If API request fails
        RegistryClientError: If client processing fails
        httpx.RequestError: If HTTP request fails
        ValidationError: If response validation fails
        ValueError: If server is not found

    """
    async with RegistryClient() as client:
        server = await client.get_server_by_name(self.args.server_name)

        if server is None:
            msg = f'Server "{self.args.server_name}" not found'
            raise ValueError(msg)

        return server

format_output(result)

Format and display server information.

Parameters:

Name Type Description Default
result Server

Server object with detailed information

required
Source code in mcp_registry_client/commands/info.py
def format_output(self, result: Server) -> None:
    """Format and display server information.

    Args:
        result: Server object with detailed information

    """
    cli_config = get_cli_config()

    if self.args.json:
        data = format_server_detailed(result)
        print_json(data, indent=cli_config.json_indent)
    else:
        print_server_info_human_readable(result)

validate_args()

Validate info command arguments.

Raises:

Type Description
ValueError

If server name is invalid

Source code in mcp_registry_client/commands/info.py
def validate_args(self) -> None:
    """Validate info command arguments.

    Raises:
        ValueError: If server name is invalid

    """
    validate_server_name(self.args.server_name)