8000 feat: adding correct tool annotations by vanhtuan0409 · Pull Request #184 · ClickHouse/mcp-clickhouse · GitHub
[go: up one dir, main page]

Skip to content

feat: adding correct tool annotations - #184

Open
vanhtuan0409 wants to merge 1 commit into
ClickHouse:mainfrom
vanhtuan0409:set-tool-annotations
Open

vanhtuan0409 wants to merge 1 commit into
ClickHouse:mainfrom
vanhtuan0409:set-tool-annotations

Conversation

@vanhtuan0409
@vanhtuan0409 vanhtuan0409 commented May 22, 2026 •
Copy link
Copy Markdown

Summary

  • Add MCP ToolAnnotations with readOnlyHint to all registered tools
  • list_databases, list_tables, and run_chdb_select_query are marked as readOnlyHint=True (always read-only)
  • run_query annotation is set dynamically based on CLICKHOUSE_ALLOW_WRITE_ACCESS: read-only by default, non-read-only when write access is enabled

Motivation

MCP clients (e.g. Claude Code, ChatGPT) use tool annotations to decide whether to prompt users for confirmation before executing a tool call. Without annotations, clients may conservatively require confirmation for every call — even read-only ones like listing databases or tables.

Test plan

  • Verify list_databases, list_tables, run_chdb_select_query expose readOnlyHint=true in tool metadata
  • Verify run_query exposes readOnlyHint=true when CLICKHOUSE_ALLOW_WRITE_ACCESS is unset or false
  • Verify run_query exposes readOnlyHint=false when CLICKHOUSE_ALLOW_WRITE_ACCESS=true

🤖 Generated with Claude Code

@CLAassistant
CLAassistant commented May 22, 2026 •
Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@dengaleev
Copy link
Copy Markdown

Hi, @joe-clickhouse, could this one get a review? We run mcp-clickhouse in read-only mode, and without readOnlyHint the client can't classify list_databases / list_tables / run_query as read-only.

@joe-clickhouse
Copy link
Copy Markdown
Collaborator

Hi @vanhtuan0409 sorry for the delay here! Thanks for this though. The annotations are still needed after the FastMCP 4 migration. Could you rebase onto current main, preserve the async tool wrappers, and add MCP client tests for read-only and write-enabled configs?

Also please either omit or set readOnlyHint=false for run_chdb_select_query becuase it accepts arbitrary SQL, including CREATE and INSERT and as such it is not currently read-only.

This branch has not been deployed

No deployments
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.

4 participants

0