ActionToolScanner
Discovers #[Route] action classes that are also decorated with the SDK’s own #[McpTool] attribute — “add one attribute to an existing action” is the headline feature.
Modeled on AttributeRouteScanner: reuses it to find every #[Route] action, then resolves each one’s class the same way Controller::createActionInstance() does and inspects it for #[McpTool].
A no-op (empty result) when mcp/sdk isn’t installed — guarded the same way the ORM adapters guard on their optional dependency.
Synopsis
Section titled “Synopsis”final class ActionToolScanner
| Source | Compiler/ActionToolScanner.php |
Methods
Section titled “Methods”| Method | Description |
|---|---|
| [`scan(Controller $controller, iterable | null $moduleDirs = null): list |
scan()
Section titled “scan()”public function scan(Controller $controller, iterable<string>|null $moduleDirs = null): list<ActionToolDefinition>
Defaults to AttributeRouteScanner’s own default.
| Parameter | Type | Description |
|---|---|---|
$controller | Controller | |
$moduleDirs | `iterable<string> | “null` |
Returns list``<ActionToolDefinition>