Skip to content

omicverse.mcp.class_specs

source module omicverse.mcp.class_specs

Wrapper specifications for class-backed MCP tools.

Each wrapped class has a ClassWrapperSpec that defines its fixed action set, parameter schemas, and lifecycle rules. No generic method dispatch is ever allowed — every callable action is explicitly enumerated here.

Classes

  • ActionSpec Describes one allowed action on a wrapped class.

  • ClassWrapperSpec Complete wrapper definition for a class-backed tool.

Functions

source dataclass ActionSpec(name: str, method: str, params: Dict[str, dict] = field(default_factory=dict), required_params: List[str] = field(default_factory=list), needs_instance: bool = True, needs_adata: bool = False, returns: str = 'json', description: str = '', handler: Optional[Callable] = field(default=None, repr=False))

Describes one allowed action on a wrapped class.

source dataclass ClassWrapperSpec(full_name: str, tool_name: str, actions: Dict[str, ActionSpec] = field(default_factory=dict), description: str = '', rollout_phase: str = 'P2', available: bool = True, runtime_requirements: Dict[str, List[str]] = field(default_factory=dict))

Complete wrapper definition for a class-backed tool.

source register_spec(spec: ClassWrapperSpec)None

Register a wrapper spec by full_name.

source get_spec(full_name: str)Optional[ClassWrapperSpec]

Retrieve spec or None.

source all_specs()Dict[str, ClassWrapperSpec]

Return all registered specs.

source get_spec_by_tool_name(tool_name: str)Optional[ClassWrapperSpec]

Look up a spec by its MCP tool name (e.g. "ov.bulk.pydeg").

source build_class_tool_schema(spec: ClassWrapperSpec)dict

Build a flat JSON Schema for a class tool with action enum.

All action-specific params are merged as optional properties. The adapter validates per-action requirements at invocation time.