@shopify/dev-mcp: add readOnlyHint to read-only tools so they don't prompt on every call in plan mode

Đang mở Phù hợp với người mới
#79 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
80/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
node.js, typescript
Lĩnh vực
devtools

Hướng nghiên cứu

Chạy grep trên gói dev-mcp để tìm registerTool("search_docs_chunks" nhằm xác định nơi năm công cụ được đăng ký; cùng tệp đó (hoặc một mô-đun anh em theo từng công cụ) chứa bốn công cụ còn lại. Thêm các đối tượng annotations từ bảng của issue vào search_docs_chunks, learn_shopify_api, validate và validate_theme, để feedback không có chú thích. Hoàn tất là khi đầu dò tái tạo tools/list in ra readOnlyHint khác null cho đúng bốn công cụ đó.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Summary

@shopify/dev-mcp 1.19.0 returns no annotations for any of its five tools in tools/list. MCP clients that gate on tool annotations therefore have to treat every call, including a plain docs search, as potentially state-changing.

Impact

In Claude Code's plan mode (its read-only research mode), MCP tools that the server marks readOnlyHint: true run without asking (docs). Every other MCP tool prompts for approval on each call, and those prompts don't offer "Always allow". As a result, each search_docs_chunks, learn_shopify_api and validate call during planning needs its own manual approval, even though looking up docs is exactly what plan mode is for. Other docs servers such as @upstash/context7-mcp already set readOnlyHint: true and run without prompts.

Reproduction

{ printf '%s\n' \
  '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"probe","version":"0"}}}' \
  '{"jsonrpc":"2.0","method":"notifications/initialized"}' \
  '{"jsonrpc":"2.0","id":2,"method":"tools/list"}'; sleep 5; } \
| npx -y @shopify/[email protected] | jq -c 'select(.id==2) | .result.tools[] | {name, annotations}'

Output:

{"name":"feedback","annotations":null}
{"name":"learn_shopify_api","annotations":null}
{"name":"search_docs_chunks","annotations":null}
{"name":"validate","annotations":null}
{"name":"validate_theme","annotations":null}

Suggested fix

Based on the tool descriptions, four of the five tools only read. Annotating them would let clients run them in read-only modes:

Tool Suggested annotations
search_docs_chunks readOnlyHint: true, openWorldHint: true
learn_shopify_api readOnlyHint: true, openWorldHint: true
validate readOnlyHint: true
validate_theme readOnlyHint: true (it reads theme files; it doesn't modify them)
feedback leave unannotated, since it submits data to Shopify

With the MCP TypeScript SDK this is the annotations field on registerTool:

server.registerTool("search_docs_chunks", {
  description: "...",
  inputSchema: { /* ... */ },
  annotations: { readOnlyHint: true, openWorldHint: true },
}, handler);

Environment

  • @shopify/dev-mcp 1.19.0 (latest at time of writing), run with npx -y @shopify/dev-mcp@latest
  • Claude Code 2.1.330 (desktop app), macOS
Ngôn ngữ chính
JavaScript
Star
652
Fork
88
Merge trung bình
6 phút
Pull request đã merge (30 ngày)
2

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Shopify/Shopify-AI-Toolkit

Tất cả issue của Shopify/Shopify-AI-Toolkit

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.