Package com.tnsai.mcp.database
Class GoogleMcpToolboxClient
java.lang.Object
com.tnsai.mcp.database.GoogleMcpToolboxClient
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 Summary
ConstructorsConstructorDescriptionGoogleMcpToolboxClient(McpClient mcpClient) Creates a new GoogleMcpToolboxClient wrapping the given MCP client. -
Method Summary
Modifier and TypeMethodDescriptioncom.fasterxml.jackson.databind.JsonNodedescribeTable(String table) Describes the schema of a table.com.fasterxml.jackson.databind.JsonNodeexecuteQuery(String query) Executes a SQL query.Returns the underlying MCP client.booleanChecks if the Google MCP Toolbox server is available.com.fasterxml.jackson.databind.JsonNodeLists available databases.
-
Constructor Details
-
GoogleMcpToolboxClient
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
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
Lists available databases.- Returns:
- the list of databases as JSON
- Throws:
IOException- if the MCP call fails
-
describeTable
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
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
-