Commit 33fc4e9
D3 gen_mcp_schema.py: fix two struct-parsing bugs
Bug 1 — comment brace stops struct regex prematurely:
_STRUCT_RE uses [^}]+ which stops at the first '}' character.
A struct body comment like '* Defaults: {0.01, 0.05}' contains a '}'
that terminates the capture before the actual struct closing brace,
causing the struct to be silently dropped from the parsed output.
Fix: strip comments from the full header_text before running _STRUCT_RE
(not just from the body after the fact). This recovers structs like
finbench_monte_carlo_request_t which had exactly this pattern.
Bug 2 — camelCase operation names not matched to snake_case struct names:
find_request_struct tried '{prefix}{op_name}_request_t' literally, so
'portfolioVariance' never matched 'finbench_portfolio_variance_request_t'.
Fix: add _camel_to_snake() helper (regex: insert '_' before each uppercase
that follows a lowercase/digit, then lowercase) and extend the candidate
list to include the snake_case variants at every prefix level.
After both fixes, running the tool against financial_benchmark_service.h
correctly parses 8 structs (was 7) and matches portfolioVariance and
monteCarlo to their request structs. scenarioAnalysis remains a SKIP
because finbench_scenario_request_t uses an abbreviated name — its
hand-crafted services.xml schema is intentionally richer and kept.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 69a8585 commit 33fc4e9
1 file changed
Lines changed: 39 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
127 | | - | |
128 | | - | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
129 | 131 | | |
130 | 132 | | |
131 | | - | |
| 133 | + | |
132 | 134 | | |
133 | 135 | | |
134 | 136 | | |
135 | 137 | | |
136 | 138 | | |
| 139 | + | |
| 140 | + | |
137 | 141 | | |
138 | 142 | | |
139 | 143 | | |
140 | 144 | | |
141 | 145 | | |
142 | | - | |
| 146 | + | |
| 147 | + | |
143 | 148 | | |
144 | 149 | | |
145 | 150 | | |
| |||
204 | 209 | | |
205 | 210 | | |
206 | 211 | | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
207 | 227 | | |
208 | 228 | | |
209 | 229 | | |
210 | 230 | | |
211 | 231 | | |
212 | 232 | | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
217 | 238 | | |
| 239 | + | |
218 | 240 | | |
219 | 241 | | |
220 | 242 | | |
| 243 | + | |
| 244 | + | |
221 | 245 | | |
222 | 246 | | |
223 | 247 | | |
224 | 248 | | |
| 249 | + | |
| 250 | + | |
225 | 251 | | |
226 | 252 | | |
227 | 253 | | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
233 | 259 | | |
234 | 260 | | |
235 | 261 | | |
| |||
0 commit comments