Commit a7ec04a
authored
docs: add MCP tool docstring guidelines to AGENTS.md and styleguide (homeassistant-ai#907)
* docs(agents): add Tool Docstrings guidelines and update template
Builds on the foundation laid by homeassistant-ai#752 (@julienld). Adds a structured
`### Tool Docstrings` section to AGENTS.md and updates the tool template
to show optional blocks as comments rather than a prescriptive skeleton.
Key design choices:
- Single-line template remains the default (progressive disclosure)
- Optional blocks (RELATED TOOLS, EXAMPLES, NOTE) are comments in the
template, with guidelines on when to use each
- Explicit "What NOT to include" list to prevent over-documentation
- Corrects ha_get_domain_docs -> ha_get_skill_home_assistant_best_practices
* docs(styleguide): add MCP Tool Docstrings review section
Complements the AGENTS.md Tool Docstrings guidelines. Gives Gemini Code
Assist actionable MEDIUM-severity flags for the most common docstring
problems while explicitly excluding false positives on legitimate concise
docstrings (progressive disclosure: brief by default).
Builds on homeassistant-ai#752 (@julienld).
* fix(docs): restructure template, add remove verb, address GB findings
Finding 1: Move developer guidance comments outside the docstring
triple-quotes. Restores the original convention: docstring content
inside """, developer notes as Python comments after closing """.
This ensures the template teaches correct Python structure.
Finding 2: Add `remove` to Naming Convention and verb checklist.
13 tools use ha_remove_*/ha_config_remove_* vs 4 ha_*delete_*.
`remove` is the dominant verb for registry items but was undocumented.
Also clarifies the delete vs remove distinction inline.
Finding 3 (no change): The `# For complex schemas` in prose correctly
shows a Python comment in the function body. Removing the # would
conflate a developer note with docstring content -- explained in PR.
* fix(docs): correct delete example in Naming Convention
ha_config_delete_automation does not exist -- it was a pre-existing
error in AGENTS.md. Replaced with ha_config_delete_dashboard (real tool).
Also corrected the description: delete covers dashboards, config entries,
and files -- not just files as GB suggested (ha_config_delete_dashboard,
ha_config_delete_dashboard_resource, ha_delete_config_entry confirm this).
* fix(docs): use 'delete' in delete verb description
After introducing 'remove' as a separate verb category, describing
'delete' as 'remove dashboards...' was ambiguous. Using 'delete' in
the description eliminates the semantic overlap.
* fix(styleguide): add Remove to verb list, drop superseded Tool descriptions item1 parent a6ff2fe commit a7ec04a
2 files changed
Lines changed: 53 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
99 | | - | |
100 | | - | |
101 | | - | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
102 | 117 | | |
103 | 118 | | |
104 | 119 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
523 | 523 | | |
524 | 524 | | |
525 | 525 | | |
526 | | - | |
| 526 | + | |
| 527 | + | |
527 | 528 | | |
528 | 529 | | |
529 | 530 | | |
| |||
534 | 535 | | |
535 | 536 | | |
536 | 537 | | |
537 | | - | |
538 | | - | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
539 | 547 | | |
540 | 548 | | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
541 | 573 | | |
542 | 574 | | |
543 | 575 | | |
| |||
0 commit comments