| @@ -400,8 +400,15 @@ | ||
| 400 | 400 | |
| 401 | 401 | // Build array of ability names. |
| 402 | 402 | $ability_names = array(); |
| 403 | 403 | foreach ( $abilities as $ability ) { |
| 404 | + | |
| 405 | + // Skip if this ability is not an instance of ConvertKit_MCP_Ability. | |
| 406 | + if ( ! ( $ability instanceof ConvertKit_MCP_Ability ) ) { | |
| 407 | + continue; | |
| 408 | + } | |
| 409 | + | |
| 410 | + // Add ability name. | |
| 404 | 411 | $ability_names[] = $ability->get_name(); |
| 405 | 412 | } |
| 406 | 413 | |
| 407 | 414 | // Build array of resource names. |
| @@ -406,8 +413,15 @@ | ||
| 406 | 413 | |
| 407 | 414 | // Build array of resource names. |
| 408 | 415 | $resource_names = array(); |
| 409 | 416 | foreach ( convertkit_get_resources() as $resource ) { |
| 417 | + | |
| 418 | + // Skip if this resource is not an instance of ConvertKit_MCP_Resource. | |
| 419 | + if ( ! ( $resource instanceof ConvertKit_MCP_Resource ) ) { | |
| 420 | + continue; | |
| 421 | + } | |
| 422 | + | |
| 423 | + // Add resource name. | |
| 410 | 424 | $resource_names[] = $resource->get_name(); |
| 411 | 425 | } |
| 412 | 426 | |
| 413 | 427 | // Build array of prompt names. |
| @@ -412,8 +426,15 @@ | ||
| 412 | 426 | |
| 413 | 427 | // Build array of prompt names. |
| 414 | 428 | $prompt_names = array(); |
| 415 | 429 | foreach ( convertkit_get_prompts() as $prompt ) { |
| 430 | + | |
| 431 | + // Skip if this prompt is not an instance of ConvertKit_MCP_Prompt. | |
| 432 | + if ( ! ( $prompt instanceof ConvertKit_MCP_Prompt ) ) { | |
| 433 | + continue; | |
| 434 | + } | |
| 435 | + | |
| 436 | + // Add prompt name. | |
| 416 | 437 | $prompt_names[] = $prompt->get_name(); |
| 417 | 438 | } |
| 418 | 439 | |
| 419 | 440 | // Create the MCP server. |