use serde_json::{Value, json};
use crate::error::ToolError;
use crate::protocol::ServerState;
pub fn metadata() -> Value {
json!({
"name": "schema_dump",
"description": "Return the full schema of the database as a sequence of \
`CREATE TABLE` statements (the same dump the `ask` tool \
feeds the LLM). Useful for priming your own context with the \
whole schema in one call rather than walking every table \
with `describe_table`. Tables are emitted in alphabetical \
order so the output is deterministic.",
"inputSchema": {
"type": "object",
"properties": {},
"additionalProperties": false,
}
})
}
pub fn handle(_args: Value, state: &mut ServerState) -> Result<String, ToolError> {
let db = state.conn.database();
let dump = sqlrite::ask::schema::dump_schema_for_database(&db);
Ok(dump)
}