Skip to main content
Glama

generate_from_stub

Generate PHP classes from any of 42 framework stub templates. Apply token replacements for namespace, class name, and custom tokens to produce ready-to-use code.

Instructions

Generate a PHP class from any framework stub template. Reads the stub, applies token replacements, and returns the generated code. Covers all 42 stub types: provider, model, controller, middleware, migration, event, listener, subscriber, posttype, taxonomy, shortcode, widget, metabox, menu, settings, rest, ajax, cron, command, cast, enum, exception, factory, filter, action, interface, job, mail, notification, observer, policy, render, resource, rule, scope, seeder, service, test, trait, block, columns.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
stubYesStub name (e.g., "provider", "model", "middleware", "posttype", "settings")
namespaceYesPHP namespace (e.g., "MyPlugin\\Providers")
classNameYesClass name to generate (e.g., "SettingsServiceProvider")
extraTokensNoAdditional token replacements beyond NAMESPACE and CLASS_NAME
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It states the tool 'reads the stub, applies token replacements, and returns the generated code,' which implies a non-destructive read operation. However, it does not disclose whether the tool has side effects (e.g., creating files), requires authentication, or has rate limits. More detail on safety would be beneficial.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is four sentences, starting with the core action and then providing scope. It is well-structured but could be slightly more concise by omitting the full list of stub types, though that list adds helpful context.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has 4 parameters (including a nested object) and no output schema, the description covers its main behavior and the full range of stub types. It mentions the output is 'returned' but does not detail the format (e.g., string, object) or error conditions. Nevertheless, it is fairly complete for a code generation tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the input schema already documents all parameters. The description adds context about 'additional token replacements beyond NAMESPACE and CLASS_NAME' which mirrors the extraTokens parameter description. It does not add significant new semantics beyond what the schema provides.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it generates a PHP class from a framework stub template, lists the 42 stub types it covers, and distinguishes it from sibling tools that are more specific (e.g., generate_controller, generate_model). It specifies the verb 'generate' and the resources 'PHP class' and 'framework stub template'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description does not explicitly state when to use this tool versus the many specific sibling generators like generate_controller or generate_posttype. It implies broad coverage ('Covers all 42 stub types') but offers no guidance on when a specific generator would be preferred.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/WPDiggerStudio/wpzylos-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server