8000 Add Agents Schema discovery hint to server instructions by felipempleite · Pull Request #245 · ClickHouse/mcp-clickhouse · GitHub
[go: up one dir, main page]

Skip to content

Add Agents Schema discovery hint to server instructions - #245

Merged
joe-clickhouse merged 1 commit into
ClickHouse:mainfrom
felipempleite:codex/agents-schema-discovery-hint
Oct 6, 2026
Merged

joe-clickhouse merged 1 commit into
ClickHouse:mainfrom
felipempleite:codex/agents-schema-discovery-hint

Conversation

@felipempleite
Copy link
Copy Markdown
Contributor

Summary

Small follow-up to #231, following the discovery-first approach suggested in review.

Adds one sentence to the existing server instructions:

If list_databases reveals an AGENTS database, use run_query to read AGENTS.ROOT for available metadata before writing analytical SQL.

The rest of the change documents the hint and tests its delivery through modern and legacy MCP clients, including startup configurations with ClickHouse disabled and without opening a database connection.

Why

Published Agents Schema metadata can help agents understand the data before writing a query. The existing discovery and query tools already provide access; this change points agents toward that path without changing query execution.

This is guidance only: no SQL scanner, automatic metadata queries, extra worker pools, caches, feature flags, or tool-result changes. Model-description enrichment and engine guidance are out of scope. Agents must follow the hint, and existing ClickHouse permissions still apply; missing or inaccessible metadata returns the normal query error.

Validation

  • Full suite on Python 3.12 with all extras and ClickHouse 26.3.41.4: 854 passed, 1 expected failure.
  • Instruction/startup suite: 22 passed each on Python 3.10 with minimum clickhouse-connect 1.0.0 and Python 3.14 with locked dependencies.
  • Live MCP smoke checks cover absent AGENTS, missing ROOT, successful explicit discovery and metadata reads in modern/legacy modes, and a read-only user with and without SELECT on AGENTS.ROOT.
  • The new hint assertion fails on upstream instructions and passes with this change. Repository-wide Ruff lint, whitespace checks, and wheel/source-distribution builds pass.

These are local validation results; GitHub CI remains to be run.

@joe-clickhouse
joe-clickhouse commented Oct 6, 2026 •
Copy link
Copy Markdown
Collaborator

@felipempleite I very much prefer this approach! Simpler and sticks with an already set precedent. When it's ready for review, please change from draft to ready and I'll take a proper look. Thanks!

@felipempleite
felipempleite marked this pull request as ready for review October 6, 2026 21:26
@felipempleite
Copy link
Copy Markdown
Contributor Author

@joe-clickhouse Me too! Thanks for the review and feedback on the original PR, this is definitely a cleaner approach 😅

@joe-clickhouse joe-clickhouse left a comment
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thanks again!

Copilot AI left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The focused documentation and instruction change is consistent, tested, and introduces no query-execution changes.

Review effort: Balanced
Findings: None

What changed in this PR

Adds Agents Schema discovery guidance to server instructions without changing query behavior.

Changes:

  • Directs agents to inspect AGENTS.ROOT after database discovery.
  • Documents the guidance and adds modern/legacy client coverage.
  • Records the user-visible addition in the changelog.
File Description
mcp_clickhouse/​skills_advisor.py Adds the discovery hint.
tests/​test_skills_advisor.py Verifies hint content.
tests/​test_startup_contract.py Verifies instruction delivery across client modes and startup configurations.
README.md Documents behavior and permissions.
CHANGELOG.md Records the new guidance.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@joe-clickhouse
joe-clickhouse merged commit d21fe75 into ClickHouse:main Oct 6, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

0