sqlite-query
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSQLite Query via MCP
基于MCP的SQLite查询
Use this skill when you need to query SQLite databases, inspect schemas, or optimize queries. Read-only by default for safety.
当你需要查询SQLite数据库、检查模式或优化查询时使用此技能。为保障安全,默认启用只读模式。
Available Tools
可用工具
| Tool | What it does |
|---|---|
| Execute SQL (SELECT, PRAGMA, EXPLAIN, WITH). Returns results as a table. |
| Full schema: all tables with columns, types, and row counts |
| Detailed info for a single table: columns, constraints, row count |
| Run EXPLAIN QUERY PLAN for query optimization |
| List .db, .sqlite, .sqlite3 files in a directory |
| 工具 | 功能说明 |
|---|---|
| 执行SQL(SELECT、PRAGMA、EXPLAIN、WITH),以表格形式返回结果。 |
| 返回完整模式:所有表的列、数据类型和行数 |
| 单个表的详细信息:列、约束、行数 |
| 执行EXPLAIN QUERY PLAN用于查询优化 |
| 列出指定目录下的.db、.sqlite、.sqlite3文件 |
Workflow
工作流程
- to find .db files in the project
list_databases - to understand the full database structure
schema - for detailed column info on specific tables
table_info - to run SELECT queries and inspect data
query - to optimize slow queries
explain
- 执行查找项目中的.db文件
list_databases - 执行了解完整的数据库结构
schema - 执行获取指定表的详细列信息
table_info - 执行运行SELECT查询并检查数据
query - 执行优化慢查询
explain
Key Patterns
核心要点
- Read-only by default — only SELECT, PRAGMA, EXPLAIN, and WITH are allowed
- Pass in tool args to enable INSERT, UPDATE, DELETE
readonly: false - returns everything at once — use it first to understand the database
schema - returns tabular results — ideal for exploration and debugging
query - Database path is passed per-tool call, not globally configured
- 默认只读 —— 仅允许执行SELECT、PRAGMA、EXPLAIN和WITH语句
- 如需启用INSERT、UPDATE、DELETE,可在工具参数中传入
readonly: false - 会一次性返回所有信息 —— 建议优先使用它来了解数据库情况
schema - 返回表格化结果 —— 非常适合数据探索和调试
query - 数据库路径随每次工具调用传入,无需全局配置
Safety
安全说明
- Read-only mode is on by default — no accidental mutations
- Confirm with the user before enabling write mode ()
readonly: false - Large result sets are truncated — use LIMIT in queries for efficiency
- 默认启用只读模式 —— 不会发生意外的数据变更
- 启用写入模式()前请先征得用户同意
readonly: false - 大型结果集会被截断 —— 建议在查询中使用LIMIT提升查询效率