Class GoogleMcpToolboxClient

java.lang.Object
com.tnsai.mcp.database.GoogleMcpToolboxClient

public class GoogleMcpToolboxClient extends Object
Client for Google MCP Toolbox (Cloud SQL, Firestore, etc.).

Provides convenience methods for common database operations by wrapping MCP tool calls to a Google MCP Toolbox server. All operations are performed through the underlying McpClient.

Example usage:


 McpClient mcpClient = McpClient.create(transport);
 mcpClient.connect();
 mcpClient.initialize();

 GoogleMcpToolboxClient google = new GoogleMcpToolboxClient(mcpClient);
 JsonNode databases = google.listDatabases();
 JsonNode result = google.executeQuery("SELECT * FROM users LIMIT 10");
 
See Also:
  • Constructor Details

    • GoogleMcpToolboxClient

      public GoogleMcpToolboxClient(McpClient mcpClient)
      Creates a new GoogleMcpToolboxClient wrapping the given MCP client.
      Parameters:
      mcpClient - the MCP client connected to a Google MCP Toolbox server
      Throws:
      IllegalArgumentException - if mcpClient is null
  • Method Details

    • executeQuery

      public com.fasterxml.jackson.databind.JsonNode executeQuery(String query) throws IOException
      Executes a SQL query.
      Parameters:
      query - the SQL query to execute
      Returns:
      the query results as JSON
      Throws:
      IOException - if the MCP call fails
    • listDatabases

      public com.fasterxml.jackson.databind.JsonNode listDatabases() throws IOException
      Lists available databases.
      Returns:
      the list of databases as JSON
      Throws:
      IOException - if the MCP call fails
    • describeTable

      public com.fasterxml.jackson.databind.JsonNode describeTable(String table) throws IOException
      Describes the schema of a table.
      Parameters:
      table - the table name
      Returns:
      the table description as JSON
      Throws:
      IOException - if the MCP call fails
    • getMcpClient

      public McpClient getMcpClient()
      Returns the underlying MCP client.
      Returns:
      the MCP client
    • isAvailable

      public boolean isAvailable()
      Checks if the Google MCP Toolbox server is available.
      Returns:
      true if the MCP client is connected and initialized