oas2mcp.viewers.classification¶
Rich viewers for MCP classification results.
- Purpose:
Render
McpBundle,McpCandidate, and compact agent-context previews in a readable terminal format using Rich.- Design:
Keep classification output separate from raw OpenAPI catalog viewers.
Provide both a compact bundle summary and a detailed candidate view.
Optimize for readability when names and URIs are long.
Surface key agent-prep metadata such as auth, safety, prompts, notes, request refs, response refs, and resolved security details.
Examples
from rich.console import Console
from oas2mcp.viewers.classification import render_mcp_bundle_summary
render_mcp_bundle_summary(bundle, console=Console())
Functions¶
|
Build an overview panel for the agent-facing operation context. |
|
Build a small deterministic rationale panel for one classification. |
|
Build a request-vs-response schema ref table for an operation. |
|
Build a table of resolved security scheme details for a candidate. |
|
Build a Rich table of candidate counts by kind and safety level. |
|
Build a Rich overview panel for an MCP bundle. |
|
Build a metadata table for one MCP candidate. |
|
Build a notes panel for one MCP candidate. |
|
Build an overview panel for one MCP candidate. |
|
Build a table of suggested prompt templates for a candidate. |
|
Build a compact candidate summary table. |
|
Render a Rich summary for an MCP candidate bundle. |
|
Render a detailed Rich view for one MCP candidate. |
Render a compact preview of the agent-facing operation context. |
Module Contents¶
- oas2mcp.viewers.classification.build_agent_context_overview_panel(*, catalog: oas2mcp.models.normalized.ApiCatalog, operation: oas2mcp.models.normalized.ApiOperation, candidate: oas2mcp.models.mcp.McpCandidate) rich.panel.Panel[source][source]¶
Build an overview panel for the agent-facing operation context.
- Parameters:
catalog – The normalized API catalog.
operation – The normalized API operation.
candidate – The MCP candidate derived from the operation.
- Returns:
A Rich panel.
- Raises:
None. –
Examples
panel = build_agent_context_overview_panel( catalog=catalog, operation=operation, candidate=candidate, )
- oas2mcp.viewers.classification.build_agent_context_rationale_panel(*, operation: oas2mcp.models.normalized.ApiOperation, candidate: oas2mcp.models.mcp.McpCandidate) rich.panel.Panel[source][source]¶
Build a small deterministic rationale panel for one classification.
- Parameters:
operation – The normalized API operation.
candidate – The MCP candidate derived from the operation.
- Returns:
A Rich panel.
- Raises:
None. –
Examples
panel = build_agent_context_rationale_panel( operation=operation, candidate=candidate, )
- oas2mcp.viewers.classification.build_agent_context_refs_table(*, operation: oas2mcp.models.normalized.ApiOperation) rich.table.Table[source][source]¶
Build a request-vs-response schema ref table for an operation.
- Parameters:
operation – The normalized API operation.
- Returns:
A Rich table.
- Raises:
None. –
Examples
table = build_agent_context_refs_table(operation=operation)
- oas2mcp.viewers.classification.build_agent_context_security_table(*, catalog: oas2mcp.models.normalized.ApiCatalog, candidate: oas2mcp.models.mcp.McpCandidate) rich.table.Table[source][source]¶
Build a table of resolved security scheme details for a candidate.
- Parameters:
catalog – The normalized API catalog.
candidate – The MCP candidate.
- Returns:
A Rich table.
- Raises:
None. –
Examples
table = build_agent_context_security_table( catalog=catalog, candidate=candidate, )
- oas2mcp.viewers.classification.build_bundle_counts_table(bundle: oas2mcp.models.mcp.McpBundle) rich.table.Table[source][source]¶
Build a Rich table of candidate counts by kind and safety level.
- Parameters:
bundle – The MCP bundle.
- Returns:
A Rich table.
- Raises:
None. –
Examples
table = build_bundle_counts_table(bundle)
- oas2mcp.viewers.classification.build_bundle_overview_panel(bundle: oas2mcp.models.mcp.McpBundle) rich.panel.Panel[source][source]¶
Build a Rich overview panel for an MCP bundle.
- Parameters:
bundle – The MCP bundle.
- Returns:
A Rich panel.
- Raises:
None. –
Examples
panel = build_bundle_overview_panel(bundle)
- oas2mcp.viewers.classification.build_candidate_metadata_table(candidate: oas2mcp.models.mcp.McpCandidate) rich.table.Table[source][source]¶
Build a metadata table for one MCP candidate.
- Parameters:
candidate – The MCP candidate.
- Returns:
A Rich table.
- Raises:
None. –
Examples
table = build_candidate_metadata_table(candidate)
- oas2mcp.viewers.classification.build_candidate_notes_panel(candidate: oas2mcp.models.mcp.McpCandidate) rich.panel.Panel[source][source]¶
Build a notes panel for one MCP candidate.
- Parameters:
candidate – The MCP candidate.
- Returns:
A Rich panel.
- Raises:
None. –
Examples
panel = build_candidate_notes_panel(candidate)
- oas2mcp.viewers.classification.build_candidate_overview_panel(candidate: oas2mcp.models.mcp.McpCandidate) rich.panel.Panel[source][source]¶
Build an overview panel for one MCP candidate.
- Parameters:
candidate – The MCP candidate.
- Returns:
A Rich panel.
- Raises:
None. –
Examples
panel = build_candidate_overview_panel(candidate)
- oas2mcp.viewers.classification.build_candidate_prompts_table(candidate: oas2mcp.models.mcp.McpCandidate) rich.table.Table[source][source]¶
Build a table of suggested prompt templates for a candidate.
- Parameters:
candidate – The MCP candidate.
- Returns:
A Rich table.
- Raises:
None. –
Examples
table = build_candidate_prompts_table(candidate)
- oas2mcp.viewers.classification.build_candidate_summary_table(bundle: oas2mcp.models.mcp.McpBundle, *, max_candidates: int) rich.table.Table[source][source]¶
Build a compact candidate summary table.
- Parameters:
bundle – The MCP bundle.
max_candidates – Maximum number of candidates to display.
- Returns:
A Rich table.
- Raises:
None. –
Examples
table = build_candidate_summary_table(bundle, max_candidates=10)
- oas2mcp.viewers.classification.render_mcp_bundle_summary(bundle: oas2mcp.models.mcp.McpBundle, *, console: rich.console.Console | None = None, max_candidates: int = 15) None[source][source]¶
Render a Rich summary for an MCP candidate bundle.
- Parameters:
bundle – The MCP candidate bundle to display.
console – Optional Rich console instance.
max_candidates – Maximum number of candidates to display in the compact summary table.
- Returns:
None.
- Raises:
None. –
Examples
from rich.console import Console render_mcp_bundle_summary( bundle, console=Console(), )
- oas2mcp.viewers.classification.render_mcp_candidate_detail(candidate: oas2mcp.models.mcp.McpCandidate, *, console: rich.console.Console | None = None) None[source][source]¶
Render a detailed Rich view for one MCP candidate.
- Parameters:
candidate – The MCP candidate to display.
console – Optional Rich console instance.
- Returns:
None.
- Raises:
None. –
Examples
from rich.console import Console render_mcp_candidate_detail( bundle.candidates[0], console=Console(), )
- oas2mcp.viewers.classification.render_operation_agent_context_preview(*, catalog: oas2mcp.models.normalized.ApiCatalog, operation: oas2mcp.models.normalized.ApiOperation, candidate: oas2mcp.models.mcp.McpCandidate, console: rich.console.Console | None = None) None[source][source]¶
Render a compact preview of the agent-facing operation context.
- Parameters:
catalog – The normalized API catalog.
operation – The normalized API operation.
candidate – The first-pass MCP candidate derived from the operation.
console – Optional Rich console instance.
- Returns:
None.
- Raises:
None. –
Examples
render_operation_agent_context_preview( catalog=catalog, operation=operation, candidate=candidate, console=Console(), )