dbmcp_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 dbmcp_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 `listViews` tool.
40#[derive(Debug, Default, Deserialize, JsonSchema)]
41#[serde(rename_all = "camelCase")]
42pub struct ListViewsRequest {
43 /// Opaque pagination cursor. Omit (or pass `null`) for the first page.
44 /// On subsequent calls, pass the `nextCursor` returned by the previous
45 /// response verbatim. Cursors are opaque — do not parse, modify, or persist.
46 #[serde(default)]
47 pub cursor: Option<Cursor>,
48}
49
50/// Request for the `listTriggers` tool.
51#[derive(Debug, Default, Deserialize, JsonSchema)]
52#[serde(rename_all = "camelCase")]
53pub struct ListTriggersRequest {
54 /// Opaque pagination cursor. Omit (or pass `null`) for the first page.
55 /// On subsequent calls, pass the `nextCursor` returned by the previous
56 /// response verbatim. Cursors are opaque — do not parse, modify, or persist.
57 #[serde(default)]
58 pub cursor: Option<Cursor>,
59}
60
61/// Request for the `writeQuery` tool.
62#[derive(Debug, Default, Deserialize, JsonSchema)]
63#[serde(rename_all = "camelCase")]
64pub struct QueryRequest {
65 /// The SQL query to execute.
66 pub query: String,
67}
68
69/// Request for the `readQuery` tool.
70#[derive(Debug, Default, Deserialize, JsonSchema)]
71#[serde(rename_all = "camelCase")]
72pub struct ReadQueryRequest {
73 /// The SQL query to execute.
74 pub query: String,
75 /// Opaque pagination cursor. Omit (or pass `null`) for the first page.
76 /// On subsequent calls, pass the `nextCursor` returned by the previous
77 /// response verbatim. Cursors are opaque — do not parse, modify, or persist.
78 /// Ignored for `EXPLAIN` statements.
79 #[serde(default)]
80 pub cursor: Option<Cursor>,
81}
82
83/// Request for the `explainQuery` tool.
84#[derive(Debug, Default, Deserialize, JsonSchema)]
85#[serde(rename_all = "camelCase")]
86pub struct ExplainQueryRequest {
87 /// The SQL query to explain.
88 pub query: String,
89}