| @@ -67,13 +67,18 @@ | ||
| 67 | 67 | foreach ($allowed as $ability) { |
| 68 | 68 | $meta = $ability->get_meta(); |
| 69 | 69 | $name = $ability->get_name(); |
| 70 | 70 | $label = $ability->get_label(); |
| 71 | + $schema = $ability->get_input_schema(); | |
| 72 | + // Filters out unnecessary context | |
| 73 | + if (function_exists('wp_prepare_json_schema_for_client')) { | |
| 74 | + $schema = wp_prepare_json_schema_for_client($schema); | |
| 75 | + } | |
| 71 | 76 | $byCategory[$ability->get_category()][] = [ |
| 72 | 77 | 'name' => $name, |
| 73 | 78 | 'label' => $glossary[$label] ?? $label, |
| 74 | 79 | 'description' => $ability->get_description(), |
| 75 | - 'inputSchema' => $ability->get_input_schema(), | |
| 80 | + 'inputSchema' => $schema, | |
| 76 | 81 | 'annotations' => $meta['annotations'] ?? null, |
| 77 | 82 | 'runHref' => \rest_url('wp-abilities/v1/abilities/' . $name . '/run'), |
| 78 | 83 | ]; |
| 79 | 84 | } |