(component: ComponentDefinition)
| 172 | * This is used to register tools with the MCP server for input validation. |
| 173 | */ |
| 174 | export function getToolInputShape(component: ComponentDefinition): ToolInputShape { |
| 175 | const shape = getObjectShape(component.inputs); |
| 176 | if (!shape) { |
| 177 | return {}; |
| 178 | } |
| 179 | |
| 180 | const actionInputIds = getActionInputIds(component); |
| 181 | const filtered: ToolInputShape = {}; |
| 182 | |
| 183 | for (const id of actionInputIds) { |
| 184 | const schema = shape[id]; |
| 185 | if (schema) { |
| 186 | filtered[id] = schema; |
| 187 | } |
| 188 | } |
| 189 | |
| 190 | const exposedParamIds = getExposedParameterIds(component); |
| 191 | if (exposedParamIds.length > 0) { |
| 192 | const paramShape = getObjectShape(component.parameters); |
| 193 | if (paramShape) { |
| 194 | for (const id of exposedParamIds) { |
| 195 | if (filtered[id]) { |
| 196 | continue; |
| 197 | } |
| 198 | const schema = paramShape[id]; |
| 199 | if (schema) { |
| 200 | filtered[id] = schema; |
| 201 | } |
| 202 | } |
| 203 | } |
| 204 | } |
| 205 | |
| 206 | return filtered; |
| 207 | } |
| 208 | |
| 209 | /** |
| 210 | * Get the JSON Schema for the action inputs only (inputs exposed to the agent). |
no test coverage detected