( baseSchema: Record<string, unknown>, overrides: Record<string, string> | null | undefined )
| 194 | * the field name, matching the base converter's "no description" behavior. |
| 195 | */ |
| 196 | export function applyDescriptionOverrides( |
| 197 | baseSchema: Record<string, unknown>, |
| 198 | overrides: Record<string, string> | null | undefined |
| 199 | ): Record<string, unknown> { |
| 200 | if (!overrides || Object.keys(overrides).length === 0) return baseSchema |
| 201 | const baseProperties = baseSchema.properties as Record<string, McpToolProperty> | undefined |
| 202 | if (!baseProperties) return baseSchema |
| 203 | |
| 204 | const properties: Record<string, McpToolProperty> = {} |
| 205 | for (const [name, property] of Object.entries(baseProperties)) { |
| 206 | const override = overrides[name] |
| 207 | properties[name] = |
| 208 | typeof override === 'string' |
| 209 | ? { ...property, description: override.trim() || name } |
| 210 | : property |
| 211 | } |
| 212 | |
| 213 | return { ...baseSchema, properties } |
| 214 | } |
| 215 | |
| 216 | /** |
| 217 | * Drop override entries whose parameter no longer exists in the base schema, so the stored override |
no outgoing calls
no test coverage detected