database_mcp_sqlite/types.rs
1//! SQLite-specific MCP tool request types.
2//!
3//! Unlike `MySQL` and `PostgreSQL`, `SQLite` operates on a single file and
4//! has no database selection. These types omit the `database`
5//! field present in the shared server types.
6
7use database_mcp_server::pagination::Cursor;
8use rmcp::schemars;
9use rmcp::schemars::JsonSchema;
10use serde::Deserialize;
11
12/// Request for the `getTableSchema` tool.
13#[derive(Debug, Default, Deserialize, JsonSchema)]
14#[serde(rename_all = "camelCase")]
15pub struct GetTableSchemaRequest {
16 /// The table name to inspect. Use `listTables` first to see available tables.
17 pub table: String,
18}
19
20/// Request for the `dropTable` tool.
21#[derive(Debug, Default, Deserialize, JsonSchema)]
22#[serde(rename_all = "camelCase")]
23pub struct DropTableRequest {
24 /// Name of the table to drop. Must contain only alphanumeric characters and underscores.
25 pub table: String,
26}
27
28/// Request for the `listTables` tool.
29#[derive(Debug, Default, Deserialize, JsonSchema)]
30#[serde(rename_all = "camelCase")]
31pub struct ListTablesRequest {
32 /// Opaque pagination cursor. Omit (or pass `null`) for the first page.
33 /// On subsequent calls, pass the `nextCursor` returned by the previous
34 /// response verbatim. Cursors are opaque — do not parse, modify, or persist.
35 #[serde(default)]
36 pub cursor: Option<Cursor>,
37}
38
39/// Request for the `writeQuery` tool.
40#[derive(Debug, Default, Deserialize, JsonSchema)]
41#[serde(rename_all = "camelCase")]
42pub struct QueryRequest {
43 /// The SQL query to execute.
44 pub query: String,
45}
46
47/// Request for the `readQuery` tool.
48#[derive(Debug, Default, Deserialize, JsonSchema)]
49#[serde(rename_all = "camelCase")]
50pub struct ReadQueryRequest {
51 /// The SQL query to execute.
52 pub query: String,
53 /// Opaque pagination cursor. Omit (or pass `null`) for the first page.
54 /// On subsequent calls, pass the `nextCursor` returned by the previous
55 /// response verbatim. Cursors are opaque — do not parse, modify, or persist.
56 /// Ignored for `EXPLAIN` statements.
57 #[serde(default)]
58 pub cursor: Option<Cursor>,
59}
60
61/// Request for the `explainQuery` tool.
62#[derive(Debug, Default, Deserialize, JsonSchema)]
63#[serde(rename_all = "camelCase")]
64pub struct ExplainQueryRequest {
65 /// The SQL query to explain.
66 pub query: String,
67}