Guide

Block Library Abilities

The Story Item block registers two WordPress Abilities for AI-assisted title and blurb generation. Both abilities are exposed through REST and as public MCP tools for authenticated consumers.

Ability index

AbilityPermissionWordPress side effects
prc-ai/generate-blurbedit_posts, then edit_post for the linked postNone; sends post text to the configured AI provider
prc-ai/generate-titleedit_posts, then edit_post for the linked postNone; sends post text to the configured AI provider

Both abilities declare readonly: true, destructive: false, and idempotent: false. They are allowed for prc-block/story-item.

Generate a blurb

prc-ai/generate-blurb creates a concise one- or two-sentence summary from the linked post title and text.

Reference

Input

Typed options, defaults, and constraints in one scannable reference.
2 fields
post_id number required
Linked post ID.
site_id number
Optional multisite blog ID; defaults to the content site.

The output object has:

FieldTypeDescription
errorstringEmpty on success; otherwise a validation, permission, content, site, or AI-provider error
blurbstringGenerated plain text; empty on failure

Generate a title

prc-ai/generate-title creates a short factual headline from the linked post title and text.

Reference

Input

Typed options, defaults, and constraints in one scannable reference.
2 fields
post_id number required
Linked post ID.
site_id number
Optional multisite blog ID; defaults to the content site.

The output object has:

FieldTypeDescription
errorstringEmpty on success; otherwise a validation, permission, content, site, or AI-provider error
titlestringGenerated plain text; empty on failure

Input and content handling

The abilities prefer the post excerpt. They fall back to post content, remove HTML, normalize whitespace, and limit source text to 15,000 characters. In non-production environments, the prompt normalizes a local permalink to the configured public production origin.

Generation fails when:

  • post_id is missing or invalid.
  • The current user cannot edit the linked post.
  • The post does not exist.
  • The post has no title, excerpt, or body text.
  • The target site is invalid or does not have the plugin active.
  • The configured AI client or model returns an error.

Registration source

src/story-item/class-story-item.php conditionally registers the feature with the WordPress AI plugin. src/story-item/class-ai.php defines both abilities, their schemas, permissions, prompts, and output handling.

Was this helpful?