Commit b8e0b69
committed
fix(scripts): tools.json generator emits clean, non-duplicate descriptions
Two bugs surfaced when refreshing tools.json for the docker/mcp-registry
PR (#81 / docker/mcp-registry#2563):
- ast.walk() recursed into nested function definitions, picking up
inner `async def apply()` closures inside register_preview_tool
wiring as if they were public tools. This produced 5 duplicate
"apply" entries on top of the real 54 tools. Fixed by iterating
tree.body directly so only top-level async defs are considered.
- _extract_description took only the first non-empty line of the
docstring, which truncated mid-sentence whenever the first line
wrapped. The most visible victim was `get_inventory_movements`
(description ended in a comma) — Copilot flagged it on the
upstream PR. Eight other tools had the same issue. Fixed by
joining the first paragraph and trimming to the first complete
sentence.
Regenerating produces 54 clean tool entries, matching the production
tool set, with no truncations.1 parent 94f594e commit b8e0b69
1 file changed
Lines changed: 40 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
83 | | - | |
84 | | - | |
85 | | - | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
86 | 90 | | |
87 | 91 | | |
88 | 92 | | |
89 | | - | |
90 | 93 | | |
91 | 94 | | |
92 | 95 | | |
| |||
103 | 106 | | |
104 | 107 | | |
105 | 108 | | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
111 | 113 | | |
112 | 114 | | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
121 | 144 | | |
122 | 145 | | |
123 | 146 | | |
| |||
0 commit comments