oas2mcp.agent.enhancer.context

Deterministic context builders for the operation enhancer agent.

Purpose:

Build compact, structured context objects for refining one normalized API operation into a more MCP-friendly representation.

Design:
  • Keep context building deterministic and side-effect free.

  • Combine normalized operation data, deterministic MCP candidate data, resolved schemas, and catalog summary context.

  • Treat deterministic MCP candidate values as hints rather than final truth.

  • Keep the enhancer context focused on the current operation.

Examples

context = build_operation_enhancement_context(
    catalog=catalog,
    bundle=bundle,
    summary=summary,
    operation=operation,
)

Functions

build_operation_enhancement_context(...)

Build deterministic enhancer context for one operation.

Module Contents

oas2mcp.agent.enhancer.context.build_operation_enhancement_context(*, catalog: oas2mcp.models.normalized.ApiCatalog, bundle: oas2mcp.models.mcp.McpBundle, summary: oas2mcp.agent.summarizer.models.CatalogSummary, operation: oas2mcp.models.normalized.ApiOperation) oas2mcp.agent.enhancer.models.OperationEnhancementContext[source][source]

Build deterministic enhancer context for one operation.

Parameters:
  • catalog – The normalized API catalog.

  • bundle – The deterministic MCP bundle.

  • summary – The catalog-level summary.

  • operation – The operation to enhance.

Returns:

Deterministic context for one operation.

Return type:

OperationEnhancementContext

Raises:

KeyError – If no MCP candidate exists for the operation.

Examples

context = build_operation_enhancement_context(
    catalog=catalog,
    bundle=bundle,
    summary=summary,
    operation=operation,
)