Repository navigation
contributing
tvranjes edited this page Jun 29, 2026
·
2 revisions
- PHP 8.1+
- Composer 2.2+
- A Magento 2.4.4+ installation (for integration testing)
git clone git@gitlab.com:inchoo/magento-bricklayer.git
cd magento-bricklayer
composer install# Unit tests
vendor/bin/phpunit
# Static analysis (PHPStan level 8)
vendor/bin/phpstan analyse
# Code style (PSR-12)
vendor/bin/phpcs --standard=PSR12 src/src/ # Main PHP source code
├── Bootstrap/ # Magento initialization
├── Command/ # 6 CLI commands
├── Config/ # Configuration management
├── Exception/ # Custom exceptions
├── Guidelines/ # Guidelines compilation + local override helper
├── Integration/ # Agent config writers
└── Mcp/ # MCP server + tools
├── Tool/ # 21 tool classes (+ ToolRegistry)
├── Resource/ # 5 resource providers (+ FileLoaderTrait)
└── Prompt/ # 8 prompt providers
config/ # Auto-discovered content
├── guidelines/ # 33 markdown guidelines
└── skills/ # 28 skill directories
tests/ # PHPUnit tests
└── Unit/ # Unit test files
- Add a method with
#[McpTool]attribute to an existing tool class insrc/Mcp/Tool/:
#[McpTool(
name: 'my-new-tool',
description: 'Short description (max 80 words).',
group: 'catalog'
)]
public function myNewTool(string $requiredParam, string $optionalParam = ''): array
{
$this->requireMagento();
// Implementation
return ['result' => $data];
}-
For a new tool group, create a new class in
src/Mcp/Tool/and register it inToolRegistry. -
Add
meta: ['hidden' => true]for tier 2 tools (discoverable viasearch-toolsonly). -
For introspection tools, add a
_skill_hintfield to the success response pointing to the relevantdevelopment-contextcategory.
Drop a markdown file in the appropriate config/guidelines/ subdirectory:
config/guidelines/
├── areas/ # Area-specific (adminhtml, frontend, webapi, graphql)
├── core/ # Core patterns
├── database/ # Database patterns
├── ecosystem/ # Ecosystem-specific
├── modules/ # Module structure
└── patterns/ # Design patterns
Guidelines are auto-discovered — no registration needed.
Create a directory in config/skills/ with a SKILL.md file:
config/skills/my-new-skill/
└── SKILL.md
Then add the category mapping in ContextTools::CATEGORY_MAP.
- Add the mapping in
src/Mcp/Tool/ContextTools.phpCATEGORY_MAParray - Ensure the guideline/skill files exist in
config/ - Run
vendor/bin/bricklayer updatein a consuming project to regenerate agent documentation
-
declare(strict_types=1)in all PHP files - PSR-12 coding standard
- PHPStan level 8 compliance
- Type-hint all parameters and return types
- Constructor property promotion (PHP 8.1+)
All new tools should have corresponding unit tests in tests/Unit/Tool/. Tests should cover:
- Happy path execution
- Error handling
- Configuration checks (enabled/disabled)
- Production safety enforcement
Getting Started
Architecture
Tools Reference
- Overview (84 Tools)
- Introspection
- Catalog
- Orders
- Customers
- Database
- Logs & Diagnostics
- GraphQL
- Development
Configuration
Guidelines & Skills
Code Generation
Diagnostics
Security