Skip to main content
Glama

Generate PHP Service

scaffold_service

Generate a PHP Service for a CodeIgniter 4 resource with business logic and input validation, injecting a repository via an interface and preserving existing files unless overwrite is enabled.

Instructions

Generates a PHP Service for a resource (business logic + input validation). Receives the Repository through dependency injection via interface (contract first). Does not overwrite existing files unless overwrite=true.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "resourceName": "<resourceName>"
    },
    "name": "scaffold_service"
  }
}

Input Schema

NameRequiredDescriptionDefault
fieldsNo
overwriteNo
resourceNameYes
withRepositoryNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.6.0

TDQS

B3.2/5.0
Behavior3/5

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

With no annotations, the description carries the full burden but does disclose two real behavioral facts: existing files are preserved unless overwrite=true, and the generated service depends on a repository interface (contract first). It omits where files are written, whether the class is registered in the DI container, and what happens when the target path exists and overwrite is false (error vs silent skip).

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?

Three short sentences, front-loaded with the artifact and its contents, then the DI constraint, then the safety caveat. Nothing is padded, though the parenthetical could be folded in and a pointer to the fields format would earn its space more than the DI restatement.

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

Completeness3/5

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

For a file-generating mutation tool with no annotations, no output schema, and 0% parameter documentation, the description covers the safety-relevant overwrite behavior and the DI contract but leaves the fields payload shape and the generated file's location/return value unspecified. It is adequate to know what the tool is, less so to call it correctly on the first attempt.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate, and it only partly does: it explains the overwrite flag and hints at withRepository through the dependency-injection sentence. The fields array (name, type, required, validation for each field) is completely unaddressed, leaving the most complex parameter undocumented in both schema and description.

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

Purpose4/5

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

States a specific verb and artifact ('Generates a PHP Service for a resource') and scopes the content to business logic plus input validation. The artifact named (PHP Service) is distinct enough from siblings like scaffold_controller and scaffold_repository that an agent can pick correctly, though no sibling is explicitly named.

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?

Usage is implied by the artifact type rather than stated: an agent must infer that this is the layer between repository and controller. There is no explicit when-to-use, when-not-to-use, or prerequisite ordering (e.g., run scaffold_repository first), and no mention of scaffold_full_resource as the batch alternative.

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