Skip to main content
Glama
NekoTarou

kingbase-mcp-server

by NekoTarou

Execute Query

kb_query
Read-onlyIdempotent

Execute read-only SQL queries on a KingBase database. Use parameterized queries for safe value substitution with automatic schema qualification.

Instructions

Execute a read-only SQL query (SELECT/WITH/SHOW) against the KingBase database.

Returns query results as a formatted table. Use parameterized queries ($1, $2, ...) for safe value substitution.

Only read-only statements are allowed. For INSERT/UPDATE/DELETE use kb_execute; for DDL use kb_execute_ddl.

šŸ”‘ Auto-schema feature: Unqualified table names (without schema prefix) are automatically qualified with the configured schema (DB_SCHEMA env var). You can optionally override this with the 'schema' parameter.

Args:

  • sql (string): The SELECT query to execute

  • params (array, optional): Parameter values for $1, $2, ... placeholders

  • schema (string, optional): Override the default schema for auto-qualifying table names

Returns: Formatted table of query results with row count.

Examples:

  • sql: "SELECT * FROM biz_cm_attachment LIMIT 5" (auto-qualified with configured schema)

  • sql: "SELECT * FROM users WHERE status = $1", params: ["active"]

  • sql: "SELECT * FROM public.sys_user" (explicit schema, not auto-qualified)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sqlYesSELECT query to execute. Only read-only statements are allowed.
paramsNoOptional parameterized query values ($1, $2, ...)
schemaNoSchema name for tables without explicit schema prefix (default: from DB_SCHEMA env or 'public'). When specified, unqualified table names will be automatically prefixed with this schema.
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint=true, idempotentHint=true, destructiveHint=false, but the description adds value by explaining the return format (formatted table with row count) and the auto-schema feature. No contradictions.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Well-structured with paragraphs, bullet-like arg list, and examples. Slight redundancy ('Only read-only statements are allowed' appears in both description and schema), but overall efficient and front-loaded.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With rich annotations and full schema coverage, the description is complete. It explains return format, safety, and auto-schema. No output schema, but mentions return is a formatted table with row count, which suffices.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with descriptions for each parameter. The description adds extra context: for sql, it clarifies read-only constraint; for params, explains $1, $2 substitution; for schema, details auto-qualification and default from env var. Adds significant meaning beyond schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool executes read-only SQL queries (SELECT/WITH/SHOW) against the KingBase database, with a specific verb and resource. It distinguishes from siblings by noting DML and DDL are handled by other tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly states when to use (read-only queries) and when not ('For INSERT/UPDATE/DELETE use kb_execute; for DDL use kb_execute_ddl'). Also advises using parameterized queries for safety.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/NekoTarou/kingbase-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server