Add COX tools for doorlock, fuel, and target functionalities

- Implemented GetOxDoorlockServerFunction and GetOxDoorlockClientFunction for server-side and client-side door management, respectively.
- Created GetOxFuelServerFunction and GetOxFuelClientFunction for handling fuel management on server and client sides.
- Developed GetOxTargetClientFunction to manage targeting interactions, including global options and zone management.
- Added feature tests for all new tools to ensure functionality and error handling for unknown functions.
This commit is contained in:
Adrian Mejias committed 2026-03-01 15:35:04 -06:00
1 parent 29b854fd44
commit 24c53368a7
13 files changed
+1095

No files matched your search

@@ -0,0 +1,54 @@
<?php
use App\Mcp\Tools\COX\Doorlock\Client\GetOxDoorlockClientFunction;
use Laravel\Mcp\Request;
it('get ox_doorlock client function returns response with content', function () {
$tool = new GetOxDoorlockClientFunction;
$request = new Request(['function_name' => 'getClosestDoor']);
$response = $tool->handle($request);
expect($response)->not()->toBeNull();
expect($response->content())->not()->toBeNull();
});
it('get ox_doorlock client function handles unknown function', function () {
$tool = new GetOxDoorlockClientFunction;
$request = new Request(['function_name' => 'NonExistentFunction123']);
$response = $tool->handle($request);
$content = (string) $response->content();
expect($content)->toContain('not found');
});
it('get ox_doorlock client function works with pickClosestDoor', function () {
$tool = new GetOxDoorlockClientFunction;
$request = new Request(['function_name' => 'pickClosestDoor']);
$response = $tool->handle($request);
expect($response)->not()->toBeNull();
expect($response->content())->not()->toBeNull();
});
it('get ox_doorlock client function works with useClosestDoor', function () {
$tool = new GetOxDoorlockClientFunction;
$request = new Request(['function_name' => 'useClosestDoor']);
$response = $tool->handle($request);
expect($response)->not()->toBeNull();
expect($response->content())->not()->toBeNull();
});
it('get ox_doorlock client function supports javascript examples', function () {
$tool = new GetOxDoorlockClientFunction;
$request = new Request(['function_name' => 'getClosestDoor', 'language' => 'js']);
$response = $tool->handle($request);
expect($response)->not()->toBeNull();
expect($response->content())->not()->toBeNull();
});
@@ -0,0 +1,34 @@
<?php
use App\Mcp\Tools\COX\Doorlock\Server\GetOxDoorlockServerEvent;
use Laravel\Mcp\Request;
it('get ox_doorlock server event returns response with content', function () {
$tool = new GetOxDoorlockServerEvent;
$request = new Request(['event_name' => 'ox_doorlock:stateChanged']);
$response = $tool->handle($request);
expect($response)->not()->toBeNull();
expect($response->content())->not()->toBeNull();
});
it('get ox_doorlock server event handles unknown event', function () {
$tool = new GetOxDoorlockServerEvent;
$request = new Request(['event_name' => 'NonExistentEvent123']);
$response = $tool->handle($request);
$content = (string) $response->content();
expect($content)->toContain('not found');
});
it('get ox_doorlock server event supports javascript examples', function () {
$tool = new GetOxDoorlockServerEvent;
$request = new Request(['event_name' => 'ox_doorlock:stateChanged', 'language' => 'js']);
$response = $tool->handle($request);
expect($response)->not()->toBeNull();
expect($response->content())->not()->toBeNull();
});
@@ -0,0 +1,64 @@
<?php
use App\Mcp\Tools\COX\Doorlock\Server\GetOxDoorlockServerFunction;
use Laravel\Mcp\Request;
it('get ox_doorlock server function returns response with content', function () {
$tool = new GetOxDoorlockServerFunction;
$request = new Request(['function_name' => 'getDoor']);
$response = $tool->handle($request);
expect($response)->not()->toBeNull();
expect($response->content())->not()->toBeNull();
});
it('get ox_doorlock server function handles unknown function', function () {
$tool = new GetOxDoorlockServerFunction;
$request = new Request(['function_name' => 'NonExistentFunction123']);
$response = $tool->handle($request);
$content = (string) $response->content();
expect($content)->toContain('not found');
});
it('get ox_doorlock server function works with getDoorFromName', function () {
$tool = new GetOxDoorlockServerFunction;
$request = new Request(['function_name' => 'getDoorFromName']);
$response = $tool->handle($request);
expect($response)->not()->toBeNull();
expect($response->content())->not()->toBeNull();
});
it('get ox_doorlock server function works with editDoor', function () {
$tool = new GetOxDoorlockServerFunction;
$request = new Request(['function_name' => 'editDoor']);
$response = $tool->handle($request);
expect($response)->not()->toBeNull();
expect($response->content())->not()->toBeNull();
});
it('get ox_doorlock server function works with setDoorState', function () {
$tool = new GetOxDoorlockServerFunction;
$request = new Request(['function_name' => 'setDoorState']);
$response = $tool->handle($request);
expect($response)->not()->toBeNull();
expect($response->content())->not()->toBeNull();
});
it('get ox_doorlock server function supports javascript examples', function () {
$tool = new GetOxDoorlockServerFunction;
$request = new Request(['function_name' => 'getDoor', 'language' => 'js']);
$response = $tool->handle($request);
expect($response)->not()->toBeNull();
expect($response->content())->not()->toBeNull();
});
@@ -0,0 +1,34 @@
<?php
use App\Mcp\Tools\COX\Fuel\Client\GetOxFuelClientFunction;
use Laravel\Mcp\Request;
it('get ox_fuel client function returns response with content', function () {
$tool = new GetOxFuelClientFunction;
$request = new Request(['function_name' => 'setMoneyCheck']);
$response = $tool->handle($request);
expect($response)->not()->toBeNull();
expect($response->content())->not()->toBeNull();
});
it('get ox_fuel client function handles unknown function', function () {
$tool = new GetOxFuelClientFunction;
$request = new Request(['function_name' => 'NonExistentFunction123']);
$response = $tool->handle($request);
$content = (string) $response->content();
expect($content)->toContain('not found');
});
it('get ox_fuel client function supports javascript examples', function () {
$tool = new GetOxFuelClientFunction;
$request = new Request(['function_name' => 'setMoneyCheck', 'language' => 'js']);
$response = $tool->handle($request);
expect($response)->not()->toBeNull();
expect($response->content())->not()->toBeNull();
});
@@ -0,0 +1,34 @@
<?php
use App\Mcp\Tools\COX\Fuel\Server\GetOxFuelServerFunction;
use Laravel\Mcp\Request;
it('get ox_fuel server function returns response with content', function () {
$tool = new GetOxFuelServerFunction;
$request = new Request(['function_name' => 'setPaymentMethod']);
$response = $tool->handle($request);
expect($response)->not()->toBeNull();
expect($response->content())->not()->toBeNull();
});
it('get ox_fuel server function handles unknown function', function () {
$tool = new GetOxFuelServerFunction;
$request = new Request(['function_name' => 'NonExistentFunction123']);
$response = $tool->handle($request);
$content = (string) $response->content();
expect($content)->toContain('not found');
});
it('get ox_fuel server function supports javascript examples', function () {
$tool = new GetOxFuelServerFunction;
$request = new Request(['function_name' => 'setPaymentMethod', 'language' => 'js']);
$response = $tool->handle($request);
expect($response)->not()->toBeNull();
expect($response->content())->not()->toBeNull();
});
@@ -0,0 +1,84 @@
<?php
use App\Mcp\Tools\COX\Target\Client\GetOxTargetClientFunction;
use Laravel\Mcp\Request;
it('get ox_target client function returns response with content', function () {
$tool = new GetOxTargetClientFunction;
$request = new Request(['function_name' => 'addSphereZone']);
$response = $tool->handle($request);
expect($response)->not()->toBeNull();
expect($response->content())->not()->toBeNull();
});
it('get ox_target client function handles unknown function', function () {
$tool = new GetOxTargetClientFunction;
$request = new Request(['function_name' => 'NonExistentFunction123']);
$response = $tool->handle($request);
$content = (string) $response->content();
expect($content)->toContain('not found');
});
it('get ox_target client function works with addGlobalVehicle', function () {
$tool = new GetOxTargetClientFunction;
$request = new Request(['function_name' => 'addGlobalVehicle']);
$response = $tool->handle($request);
expect($response)->not()->toBeNull();
expect($response->content())->not()->toBeNull();
});
it('get ox_target client function works with addModel', function () {
$tool = new GetOxTargetClientFunction;
$request = new Request(['function_name' => 'addModel']);
$response = $tool->handle($request);
expect($response)->not()->toBeNull();
expect($response->content())->not()->toBeNull();
});
it('get ox_target client function works with addBoxZone', function () {
$tool = new GetOxTargetClientFunction;
$request = new Request(['function_name' => 'addBoxZone']);
$response = $tool->handle($request);
expect($response)->not()->toBeNull();
expect($response->content())->not()->toBeNull();
});
it('get ox_target client function works with addPolyZone', function () {
$tool = new GetOxTargetClientFunction;
$request = new Request(['function_name' => 'addPolyZone']);
$response = $tool->handle($request);
expect($response)->not()->toBeNull();
expect($response->content())->not()->toBeNull();
});
it('get ox_target client function works with isActive', function () {
$tool = new GetOxTargetClientFunction;
$request = new Request(['function_name' => 'isActive']);
$response = $tool->handle($request);
expect($response)->not()->toBeNull();
expect($response->content())->not()->toBeNull();
});
it('get ox_target client function supports javascript examples', function () {
$tool = new GetOxTargetClientFunction;
$request = new Request(['function_name' => 'addEntity', 'language' => 'js']);
$response = $tool->handle($request);
expect($response)->not()->toBeNull();
expect($response->content())->not()->toBeNull();
});