bug: invalid JSON in agent-format.md `allowedTools` Examples block (JS `//` comments + unquoted `@builtin`) breaks copy-paste
Valutazione
- Difficoltà
- 1/5
- Tempo stimato
- Meno di un'ora
- Idoneità per principianti
- 90/100
- Tipo di issue
- Documentazione
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Tranquilla
- Stack tecnologico
- rust
- Ambito
- documentation
Direzione di ricerca
Apri docs/agent-format.md e ispeziona il blocco Examples di allowedTools sotto l'intestazione Examples. Rimuovi i commenti inline e assicurati che la voce @builtin sia racchiusa tra virgolette, quindi convalida il blocco copiato con il parser JSON di Python. Il lavoro è terminato quando l'esempio delimitato è JSON rigoroso, copiabile e incollabile, accettato dal loader dell'agente.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Checks
- I have searched github.com/aws/amazon-q-developer-cli/issues and there are no duplicates of my issue
- N/A — this is a documentation defect, not a runtime bug (
q doctornot applicable) - N/A — this is a documentation defect, not a runtime bug (
q restartnot applicable)
Operating system
N/A (documentation defect — applies on all platforms)
Expected behaviour
The allowedTools "Examples" block in docs/agent-format.md is fenced as ```json, so copy-pasting it into an agent config file should produce a valid agent that loads.
Actual behaviour
The block is not valid JSON, so pasting it into an agent config breaks loading. Agent files are parsed with strict serde_json::from_str — crates/agent/src/agent/agent_config/mod.rs:243 (match serde_json::from_str(&entry_contents); a second loader at :371), which rejects both comments and bare/unquoted tokens.
Two problems in the block (docs/agent-format.md, ### Examples, lines ~219–244):
- JS-style
//comments on most lines (e.g.// Exact matches,// All filesystem tools). JSON has no comment syntax. - Unquoted bare token
@builtin,(line 231) — it must be the string"@builtin". The same document quotes it correctly elsewhere: the field-name list at line 124 (Use \@builtin` to include all built-in tools`) and the prose at line 215.
Verified the failure independently with a JSON parser:
$ python3 -c "import json,sys; json.load(open(sys.argv[1]))" allowedtools-example.json
json.decoder.JSONDecodeError: Expecting value: line 3 column 5
(line 3 = the first // Exact matches comment).
Steps to reproduce
- Open
docs/agent-format.md, copy the ```json fenced block under### Examples(the `allowedTools` example). - Save it as e.g.
~/.aws/amazonq/cli-agents/example.json(or paste theallowedToolsarray into an existing agent file). - The agent fails to parse —
serde_jsonrejects the//comments and the unquoted@builtintoken. Equivalent parser check:python3 -c "import json; json.load(open('example.json'))"→Expecting value: line 3 column 5.
Why it matters
The "Examples" block is the canonical reference a user reaches for when authoring allowedTools, and it is fenced as JSON, so it reads as copy-pasteable. Because agent configs are parsed with strict serde_json (no comment/trailing-comma leniency), the documented example cannot round-trip. We hit this while building a cross-platform agent-config adapter that emits these files as strict JSON: the documented form our integration pointed implementers at simply does not parse.
This is a sibling of the existing docs-accuracy gap on the same file, #3231 (the name field is no longer optional) — both are cases where agent-format.md drifted from what the loader actually accepts.
Proposed fix
Move the explanatory // annotations into prose/bullets above the snippet (or drop them), and quote the token as "@builtin", leaving a strictly-valid block:
{
"allowedTools": [
"fs_read",
"knowledge",
"@server/specific_tool",
"fs_*",
"execute_*",
"*_test",
"@builtin",
"@server/api_*",
"@server/read_*",
"@git-server/get_*_info",
"@*/status",
"@fetch",
"@git-*"
]
}
The per-entry meanings (exact match / native wildcard / @builtin = all native tools / MCP wildcards / server-level) are already explained in the surrounding "Pattern Matching Rules" and the bullet list at lines 119–125, so no information is lost by removing the inline comments.
I'm happy to open a PR with this change if that's welcome.
Environment
N/A (documentation defect)
- Lingua principale
- Rust
- Stelle
- 2k
- Fork
- 442
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di aws/amazon-q-developer-cli
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
aws/amazon-q-developer-cli#3898 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
aws/amazon-q-developer-cli#3316 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
aws/amazon-q-developer-cli#3023 · 2 commenti ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 15/100
aws/amazon-q-developer-cli#3929 ·
-
Amazon q not respondingAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 55/100
aws/amazon-q-developer-cli#3928 ·
Tutte le issue di aws/amazon-q-developer-cli
Issue simili
-
The book has a Nix install section that chelis.ch lacks, and it names two of the three systemsApertaarea:ecosystem documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Chelis-Lang/chelis#3866 ·
I maintainer di solito rispondono entro 1 giorno
-
[安卓Feature]: 数字键盘左侧符号区域大小优化Apertaenhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
metasequoiaime/msime#8620 ·
I maintainer di solito rispondono entro 1 giorno
-
agent-detection macos p2 triaged
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
I maintainer di solito rispondono entro 1 giorno
-
bug documentation sev-0
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
I maintainer di solito rispondono entro 1 giorno