adapter

Adapter integration layer that coordinates configuration, database operations, and MCP tools.

class mcp_ohmy_sql.adapter.adapter.Adapter(*, config: Config)[source]

Master adapter class that integrates configuration with database-specific operations and MCP tool implementations.

get_database_and_schema_object(database_identifier: str, schema_name: str | None = None) tuple[bool, str, Database | None, Schema | None][source]

Retrieves the database and schema objects based on the provided identifiers.

Parameters:
  • database_identifier – The identifier of the database to query.

  • schema_name – Optional schema name to filter the results. If not provided,

Returns:

A tuple containing: - A boolean indicating success or failure. - An error message if applicable. - The Database object if found, otherwise None. - The Schema object if found, otherwise None.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].