Lw lms abilities

From Lonsdale201/wp-agent-skills · View interactive version

Lw lms abilities is an AI agent skill from the GitHub repository Lonsdale201/wp-agent-skills. Consumer and reviewer reference for LW LMS 2.0.1 Abilities API registrations. Use when calling or auditing `lw-lms/list-courses`, `lw-lms/get-course`, `lw-lms/get-progress`, `lw-lms/set-progress`, `lw-lms/get-options`, `/wp-json/wp-abilities/v1/abilities/lw-lms/.../run`, Site Manager bridge integrat

How to use this skill

Skill file

LW LMS Abilities API

Use this when an AI agent, MCP client, REST consumer, or reviewer works with the machine-callable lw-lms/* abilities. This is not the learner-facing /wp-json/lms/v1 REST API and not the companion-plugin extension hook map; it is the admin/agent-facing ability surface.

When to use this skill

Trigger this skill when ANY of the following is true:

Verified registration model

LW LMS 2.0.1 registers the same five abilities in two modes. The quiz, drip, React admin, and privacy releases did not add abilities. They did tighten progress authorization and validation. Version 2.0.1 adds explicit MCP-public metadata so Site Manager can discover the foreign lw-lms/* namespace.

  1. Site Manager bridge: hooks lw_site_manager_register_categories and lw_site_manager_register_abilities, receives the Site Manager PermissionManager, and registers into category lms.
  2. Standalone fallback: hooks wp_abilities_api_categories_init and wp_abilities_api_init at priority 20. did_action() guards prevent duplicate registration when Site Manager is active.

Do not claim Site Manager is required for LMS abilities. Since v1.2.16, WordPress 6.9+ Abilities API or the feature plugin is enough.

MCP visibility

Each ability now carries:

'mcp' => [
	'public' => true,
	'type'   => 'tool',
],

With LW Site Manager 1.5.1, all five lw-lms/* abilities appear in its discovery response. MCP visibility does not bypass the ability permission callback or the target-object checks.

Ability catalog

| Ability | Type | Permission key | Input | Output |

|---|---|---|---|---|

| lw-lms/list-courses | readonly | can_edit_posts | per_page, page | success, courses, total, total_pages, page, per_page |

| lw-lms/get-course | readonly | can_edit_posts | required course_id | success, course with sections and lessons |

| lw-lms/get-progress | readonly | can_manage_lms | required user_id, course_id | summary plus lesson status map |

| lw-lms/set-progress | write | can_manage_lms | required user_id, course_id, lesson_id, status | success, message |

| lw-lms/get-options | readonly | can_manage_options | empty object | success, options |

set-progress accepts only completed, in_progress, or not_started. Reverting from completed is a write that loses the completion timestamp for that row; do not treat it as harmless even though AbilityMeta::write() marks writes idempotent.

Calling pattern

Abilities use the core Abilities API route, not the LMS REST namespace:

curl -X POST "${SITE_URL}/wp-json/wp-abilities/v1/abilities/lw-lms/get-progress/run" \
  -u 'admin:xxxx xxxx xxxx xxxx' \
  -H 'Content-Type: application/json' \
  -d '{"input":{"user_id":7,"course_id":42}}'

The request body must wrap arguments in input. Direct PHP is also valid:

$ability = wp_get_ability( 'lw-lms/set-progress' );
$result  = $ability->execute(
    [
        'user_id'   => 7,
        'course_id' => 42,
        'lesson_id' => 55,
        'status'    => 'completed',
    ]
);

Critical rules

Common mistakes

# WRONG: LMS learner REST namespace, not an ability run route.
curl -X POST "${SITE_URL}/wp-json/lms/v1/get-progress"

# RIGHT:
curl -X POST "${SITE_URL}/wp-json/wp-abilities/v1/abilities/lw-lms/get-progress/run" \
  -d '{"input":{"user_id":7,"course_id":42}}'
// WRONG: assume Site Manager must be active.
if ( ! class_exists( '\LightweightPlugins\SiteManager\Plugin' ) ) {
    return;
}

// RIGHT: check the ability/API you actually need.
if ( function_exists( 'wp_get_ability' ) && wp_get_ability( 'lw-lms/list-courses' ) ) {
    // Call it.
}

Cross-references

What this skill does NOT cover

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.