| @@ -241,20 +241,8 @@ | ||
| 241 | 241 | * |
| 242 | 242 | * @return mixed The result of the snippet execution. |
| 243 | 243 | * @throws Exception If the snippet cannot be executed. |
| 244 | 244 | */ |
| 245 | - /** | |
| 246 | - * Declare every active PHP function snippet in the current request so they can call | |
| 247 | - * one another, without executing any of them. Idempotent and cheap (runs once per | |
| 248 | - * request). executeSnippet()/executeSnippetByName() already call this internally, so | |
| 249 | - * you only need it to make function snippets callable from your own custom PHP. | |
| 250 | - * | |
| 251 | - * @return void | |
| 252 | - */ | |
| 253 | - public function loadFunctions() { | |
| 254 | - $this->core->define_all_functions(); | |
| 255 | - } | |
| 256 | - | |
| 257 | 245 | public function executeSnippetByName( $name, $args = [] ) { |
| 258 | 246 | try { |
| 259 | 247 | if ( empty( $name ) ) { |
| 260 | 248 | throw new Exception( 'The snippet name is required.' ); |
| @@ -294,9 +282,8 @@ | ||
| 294 | 282 | * - description: Description of the snippet |
| 295 | 283 | * - args: Arguments for function snippets |
| 296 | 284 | * - argsData: Argument data for function snippets (use 'description' for each argument's description) |
| 297 | 285 | * - behavior: 'dynamic' or 'static' (for function snippets) |
| 298 | - * - mcp: Expose this function as its own MCP tool in AI Engine (for function snippets) | |
| 299 | 286 | * - tags: Array of tags |
| 300 | 287 | * - priority: Execution priority |
| 301 | 288 | * - active: Active status (true/false) |
| 302 | 289 | * - endpoint: REST endpoint |
| @@ -328,9 +315,8 @@ | ||
| 328 | 315 | $description = $options['description'] ?? ''; |
| 329 | 316 | $args = $options['args'] ?? []; |
| 330 | 317 | $argsData = $options['argsData'] ?? []; |
| 331 | 318 | $behavior = $options['behavior'] ?? 'dynamic'; |
| 332 | - $mcp = $options['mcp'] ?? false; | |
| 333 | 319 | $tags = $options['tags'] ?? ['api']; |
| 334 | 320 | $priority = $options['priority'] ?? 10; |
| 335 | 321 | $active = $options['active'] ?? true; |
| 336 | 322 | $endpoint = $options['endpoint'] ?? ''; |
| @@ -374,9 +360,8 @@ | ||
| 374 | 360 | $params['functionTarget'] = $target; |
| 375 | 361 | $params['functionArgs'] = $args; |
| 376 | 362 | $params['functionArgsDict'] = $argsData; |
| 377 | 363 | $params['functionBehavior'] = $behavior; |
| 378 | - $params['functionMcp'] = $mcp; | |
| 379 | 364 | } |
| 380 | 365 | |
| 381 | 366 | // Add scheduled-specific params |
| 382 | 367 | if ( $scope === 'scheduled' ) { |
| @@ -418,9 +403,8 @@ | ||
| 418 | 403 | * - target: 'php' or 'js' (for function snippets) |
| 419 | 404 | * - args: Arguments (for function snippets) |
| 420 | 405 | * - argsData: Argument data (for function snippets) |
| 421 | 406 | * - behavior: 'dynamic' or 'static' (for function snippets) |
| 422 | - * - mcp: Expose this function as its own MCP tool in AI Engine (for function snippets) | |
| 423 | 407 | * - intervalHours: Hours (for scheduled snippets) |
| 424 | 408 | * - intervalMinutes: Minutes (for scheduled snippets) |
| 425 | 409 | * |
| 426 | 410 | * @return array The updated snippet data. |
| @@ -481,12 +465,8 @@ | ||
| 481 | 465 | $updateParams['functionTarget'] = $params['target'] ?? $snippet['functionTarget'] ?? 'php'; |
| 482 | 466 | $updateParams['functionArgs'] = $params['args'] ?? $snippet['functionArgs'] ?? []; |
| 483 | 467 | $updateParams['functionArgsDict'] = $params['argsData'] ?? $snippet['functionArgsDict'] ?? []; |
| 484 | 468 | $updateParams['functionBehavior'] = $params['behavior'] ?? $snippet['functionBehavior'] ?? 'dynamic'; |
| 485 | - // select_one() doesn't carry function metadata, so read the current MCP flag | |
| 486 | - // from the stored function to preserve it when the caller doesn't set it. | |
| 487 | - $existingFn = $this->snippet_module->get_function( $id ); | |
| 488 | - $updateParams['functionMcp'] = $params['mcp'] ?? ( $existingFn['mcp'] ?? false ); | |
| 489 | 469 | } |
| 490 | 470 | |
| 491 | 471 | // Add scheduled-specific params if it's a scheduled snippet |
| 492 | 472 | if ( $scope === 'scheduled' ) { |