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

Aperta Adatta ai principianti
#79 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
80/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
node.js, typescript
Ambito
devtools

Direzione di ricerca

Cerca con grep nel pacchetto dev-mcp registerTool("search_docs_chunks" per trovare dove sono registrati i cinque tool; lo stesso file (o un modulo fratello per tool) contiene gli altri quattro. Aggiungi gli oggetti annotations dalla tabella dell'issue a search_docs_chunks, learn_shopify_api, validate e validate_theme, lasciando feedback senza annotazione. Fatto quando la sonda di riproduzione tools/list stampa readOnlyHint non nullo per esattamente questi quattro tool.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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
Lingua principale
JavaScript
Stelle
652
Fork
88
Merge medio
6m
PR unite (30g)
2

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Shopify/Shopify-AI-Toolkit

Tutte le issue di Shopify/Shopify-AI-Toolkit

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.