oas2mcp.viewers.summary ======================= .. py:module:: oas2mcp.viewers.summary .. autoapi-nested-parse:: Rich summary viewers for normalized OpenAPI catalogs. Purpose: Render ``ApiCatalog`` and ``ApiOperation`` objects in a readable terminal format using Rich. Design: - Focus on inspection and debugging rather than mutation. - Present both an overview of the whole catalog and a detailed view for one operation. - Keep rendering functions composable and CLI-friendly. .. rubric:: Examples .. code-block:: python from rich.console import Console from oas2mcp.viewers.summary import render_catalog_summary render_catalog_summary(catalog, console=Console()) Functions --------- .. autoapisummary:: oas2mcp.viewers.summary.build_component_counts_table oas2mcp.viewers.summary.build_info_panel oas2mcp.viewers.summary.build_operation_counts_table oas2mcp.viewers.summary.build_operation_security_table oas2mcp.viewers.summary.build_operations_table oas2mcp.viewers.summary.build_overview_panel oas2mcp.viewers.summary.build_parameters_table oas2mcp.viewers.summary.build_paths_table oas2mcp.viewers.summary.build_request_body_table oas2mcp.viewers.summary.build_responses_table oas2mcp.viewers.summary.build_security_schemes_table oas2mcp.viewers.summary.build_servers_table oas2mcp.viewers.summary.build_tags_table oas2mcp.viewers.summary.render_catalog_summary oas2mcp.viewers.summary.render_operation_detail Module Contents --------------- .. py:function:: build_component_counts_table(catalog: oas2mcp.models.normalized.ApiCatalog) -> rich.table.Table Build a Rich table summarizing component counts. :param catalog: The normalized API catalog. :returns: A Rich ``Table``. :raises None.: .. rubric:: Examples .. code-block:: python table = build_component_counts_table(catalog) .. py:function:: build_info_panel(catalog: oas2mcp.models.normalized.ApiCatalog) -> rich.panel.Panel Build a Rich info panel from the catalog metadata. :param catalog: The normalized API catalog. :returns: A Rich ``Panel``. :raises None.: .. rubric:: Examples .. code-block:: python panel = build_info_panel(catalog) .. py:function:: build_operation_counts_table(catalog: oas2mcp.models.normalized.ApiCatalog) -> rich.table.Table Build a Rich table of operation counts by HTTP method. :param catalog: The normalized API catalog. :returns: A Rich ``Table``. :raises None.: .. rubric:: Examples .. code-block:: python table = build_operation_counts_table(catalog) .. py:function:: build_operation_security_table(operation: oas2mcp.models.normalized.ApiOperation) -> rich.table.Table Build a Rich table for operation security requirements. :param operation: The operation to display. :returns: A Rich ``Table``. :raises None.: .. rubric:: Examples .. code-block:: python table = build_operation_security_table(operation) .. py:function:: build_operations_table(catalog: oas2mcp.models.normalized.ApiCatalog, *, max_operations: int) -> rich.table.Table Build a Rich table summarizing normalized operations. :param catalog: The normalized API catalog. :param max_operations: Maximum number of operations to display. :returns: A Rich ``Table``. :raises None.: .. rubric:: Examples .. code-block:: python table = build_operations_table(catalog, max_operations=25) .. py:function:: build_overview_panel(catalog: oas2mcp.models.normalized.ApiCatalog) -> rich.panel.Panel Build a Rich overview panel for an ``ApiCatalog``. :param catalog: The normalized API catalog. :returns: A Rich ``Panel``. :raises None.: .. rubric:: Examples .. code-block:: python panel = build_overview_panel(catalog) .. py:function:: build_parameters_table(parameters: collections.abc.Iterable[oas2mcp.models.normalized.ApiParameter]) -> rich.table.Table Build a Rich table for normalized parameters. :param parameters: The parameters to display. :returns: A Rich ``Table``. :raises None.: .. rubric:: Examples .. code-block:: python table = build_parameters_table(operation.parameters) .. py:function:: build_paths_table(catalog: oas2mcp.models.normalized.ApiCatalog, *, max_paths: int) -> rich.table.Table Build a Rich table summarizing normalized path items. :param catalog: The normalized API catalog. :param max_paths: Maximum number of paths to display. :returns: A Rich ``Table``. :raises None.: .. rubric:: Examples .. code-block:: python table = build_paths_table(catalog, max_paths=25) .. py:function:: build_request_body_table(operation: oas2mcp.models.normalized.ApiOperation) -> rich.table.Table Build a Rich table for an operation request body. :param operation: The operation to display. :returns: A Rich ``Table``. :raises None.: .. rubric:: Examples .. code-block:: python table = build_request_body_table(operation) .. py:function:: build_responses_table(operation: oas2mcp.models.normalized.ApiOperation) -> rich.table.Table Build a Rich table for normalized responses. :param operation: The operation to display. :returns: A Rich ``Table``. :raises None.: .. rubric:: Examples .. code-block:: python table = build_responses_table(operation) .. py:function:: build_security_schemes_table(catalog: oas2mcp.models.normalized.ApiCatalog) -> rich.table.Table Build a Rich table summarizing security schemes. :param catalog: The normalized API catalog. :returns: A Rich ``Table``. :raises None.: .. rubric:: Examples .. code-block:: python table = build_security_schemes_table(catalog) .. py:function:: build_servers_table(catalog: oas2mcp.models.normalized.ApiCatalog) -> rich.table.Table Build a Rich table summarizing catalog servers. :param catalog: The normalized API catalog. :returns: A Rich ``Table``. :raises None.: .. rubric:: Examples .. code-block:: python table = build_servers_table(catalog) .. py:function:: build_tags_table(catalog: oas2mcp.models.normalized.ApiCatalog) -> rich.table.Table Build a Rich table summarizing catalog tags. :param catalog: The normalized API catalog. :returns: A Rich ``Table``. :raises None.: .. rubric:: Examples .. code-block:: python table = build_tags_table(catalog) .. py:function:: render_catalog_summary(catalog: oas2mcp.models.normalized.ApiCatalog, *, console: rich.console.Console | None = None, max_paths: int = _DEFAULT_MAX_PATHS, max_operations: int = _DEFAULT_MAX_OPERATIONS) -> None Render a full Rich summary for an ``ApiCatalog``. :param catalog: The normalized API catalog to display. :param console: Optional Rich console instance. :param max_paths: Maximum number of paths to display in the paths table. :param max_operations: Maximum number of operations to display in the operations table. :returns: None. :raises None.: .. rubric:: Examples .. code-block:: python from rich.console import Console render_catalog_summary( catalog, console=Console(), ) .. py:function:: render_operation_detail(operation: oas2mcp.models.normalized.ApiOperation, *, console: rich.console.Console | None = None) -> None Render a detailed Rich view for one operation. :param operation: The normalized operation to display. :param console: Optional Rich console instance. :returns: None. :raises None.: .. rubric:: Examples .. code-block:: python from rich.console import Console render_operation_detail( catalog.operations[0], console=Console(), )