database-mcp-backend 0.5.1

Backend for database-mcp
Documentation
//! Request types for MCP tool parameters.
//!
//! Each struct maps to the JSON input schema of one MCP tool.

use rmcp::schemars;
use rmcp::schemars::JsonSchema;
use serde::Deserialize;

/// Request to list tables in a database.
#[derive(Debug, Deserialize, JsonSchema)]
pub struct ListTablesRequest {
    #[schemars(
        description = "The database name to list tables from. Required. Use list_databases first to see available databases."
    )]
    pub database_name: String,
}

/// Request to get a table's schema.
#[derive(Debug, Deserialize, JsonSchema)]
pub struct GetTableSchemaRequest {
    #[schemars(
        description = "The database name containing the table. Required. Use list_databases first to see available databases."
    )]
    pub database_name: String,
    #[schemars(
        description = "The table name to inspect. Use list_tables first to see available tables in the database."
    )]
    pub table_name: String,
}

/// Request for `read_query` and `write_query` tools.
#[derive(Debug, Deserialize, JsonSchema)]
pub struct QueryRequest {
    #[schemars(description = "The SQL query to execute.")]
    pub sql_query: String,
    #[schemars(
        description = "The database to run the query against. Required. Use list_databases first to see available databases."
    )]
    pub database_name: String,
}

/// Request to create a database.
#[derive(Debug, Deserialize, JsonSchema)]
pub struct CreateDatabaseRequest {
    #[schemars(
        description = "Name of the database to create. Must contain only alphanumeric characters and underscores."
    )]
    pub database_name: String,
}