Skip to content

Add content-reading abilities for WordPress posts/pages #27

@bradvin

Description

@bradvin

Problem

The agent can currently read/write workspace and memory, but cannot inspect core WordPress content entities (posts/pages) through dedicated read abilities. This limits useful site-aware assistance.

Current State

  • Built-in abilities are registered under includes/abilities/ and exposed through Abilities_Helper.
  • Existing model tool flow already supports paginated/structured outputs and policy checks.

Implementation Plan

1) Add read-only content abilities

Create new built-in abilities under includes/abilities/:

  • post_list (list posts with filters)
  • post_read (read a single post/page by ID or slug)

2) Input schema (strict)

For post_list:

  • post_type (post, page initially)
  • status (default safe statuses)
  • search
  • author
  • per_page (bounded, e.g. 1-50)
  • page
  • orderby, order

For post_read:

  • one of id or slug
  • optional post_type

3) Output schema (model-friendly)

Return concise structured payload:

  • id, type, status, slug, title, excerpt, content (optionally truncated), date fields, author info, link.
  • Include pagination metadata for list endpoint.

4) Capability and policy

  • Use read-level permission callbacks (current_user_can( 'read' )) plus runtime policy gates in Abilities_Helper.
  • Mark as readonly in ability annotations.

5) Register + map

  • Register abilities in includes/class-abilities.php.
  • Add tool mapping in Abilities_Helper::TOOL_TO_ABILITY.

Acceptance Criteria

  • Agent can list and read posts/pages via tool calls.
  • Inputs are validated and bounded; invalid filters fail gracefully.
  • Outputs are deterministic and stable across repeated calls.
  • No write/delete behavior introduced.

Test Plan

  • Unit tests for ability callbacks:
    • list paging/filter behavior,
    • read by ID/slug,
    • invalid inputs.
  • Unit tests for tool declaration registration and mapping.
  • Permission tests (denied vs allowed paths).

Out of Scope

  • Editing/publishing/deleting content.
  • Full taxonomy/media traversal in this first pass.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions