( /** * The tool to get the description from. */ tool: Tool<Name, Config> )
| 1223 | * @category Utilities |
| 1224 | */ |
| 1225 | export const getDescription = < |
| 1226 | Name extends string, |
| 1227 | Config extends { |
| 1228 | readonly parameters: AnyParametersSchema |
| 1229 | readonly success: Schema.Schema.Any |
| 1230 | readonly failure: Schema.Schema.All |
| 1231 | readonly failureMode: FailureMode |
| 1232 | } |
| 1233 | >( |
| 1234 | /** |
| 1235 | * The tool to get the description from. |
| 1236 | */ |
| 1237 | tool: Tool<Name, Config> |
| 1238 | ): string | undefined => { |
| 1239 | if (Predicate.isNotUndefined(tool.description)) { |
| 1240 | return tool.description |
| 1241 | } |
| 1242 | return getDescriptionFromSchemaAst(tool.parametersSchema.ast) |
| 1243 | } |
| 1244 | |
| 1245 | /** |
| 1246 | * @since 1.0.0 |
no test coverage detected