From 29b854fd44cddac8f9fe806c5c01113f264dedf7 Mon Sep 17 00:00:00 2001 From: Adrian Mejias Date: Sun, 1 Mar 2026 15:23:07 -0600 Subject: [PATCH] Add feature tests for QBCore and FiveM tools - Implement tests for GetInventoryClientFunction and GetInventoryServerFunction in the COX namespace. - Create tests for GenerateManifest and GenerateResourceBoilerplate in the FiveM namespace. - Add tests for event and native function references in the FiveM namespace. - Introduce tests for QBCore client and server event references, functions, and configurations. - Implement tests for shared data retrieval in QBCore. - Ensure all tests validate expected responses and handle edge cases. --- app/Mcp/Servers/FiveMServer.php | 4 + .../Tools/QBCore/GetQBCoreResourceList.php | 500 ++++++++++++++++++ .../QBCore/GetQBCoreResourceReference.php | 325 ++++++++++++ .../mcp/qbcore/qbcore-resource-list.blade.php | 25 + .../qbcore-resource-reference.blade.php | 64 +++ .../GetCOXEventReferenceToolTest.php | 0 .../{ => COX}/GetCOXFunctionToolTest.php | 0 .../GetInventoryClientFunctionToolTest.php | 0 .../GetInventoryServerFunctionToolTest.php | 0 .../{ => FiveM}/GenerateManifestToolTest.php | 0 .../GenerateResourceBoilerplateToolTest.php | 0 .../GetEventClientReferenceToolTest.php | 0 .../GetEventServerReferenceToolTest.php | 0 .../GetNativeClientFunctionToolTest.php | 0 .../GetNativeServerFunctionToolTest.php | 0 .../{ => FiveM}/SearchFivemdocsToolTest.php | 0 .../GetQBCoreClientEventReferenceToolTest.php | 0 .../GetQBCoreClientFunctionToolTest.php | 0 .../{ => QBCore}/GetQBCoreConfigToolTest.php | 0 .../{ => QBCore}/GetQBCorePlayersToolTest.php | 0 .../QBCore/GetQBCoreResourceListToolTest.php | 132 +++++ .../GetQBCoreResourceReferenceToolTest.php | 138 +++++ .../GetQBCoreServerEventReferenceToolTest.php | 0 .../GetQBCoreServerFunctionToolTest.php | 0 .../GetQBCoreSharedDataToolTest.php | 0 25 files changed, 1188 insertions(+) create mode 100644 app/Mcp/Tools/QBCore/GetQBCoreResourceList.php create mode 100644 app/Mcp/Tools/QBCore/GetQBCoreResourceReference.php create mode 100644 resources/views/mcp/qbcore/qbcore-resource-list.blade.php create mode 100644 resources/views/mcp/qbcore/qbcore-resource-reference.blade.php rename tests/Feature/{ => COX}/GetCOXEventReferenceToolTest.php (100%) rename tests/Feature/{ => COX}/GetCOXFunctionToolTest.php (100%) rename tests/Feature/{ => COX}/GetInventoryClientFunctionToolTest.php (100%) rename tests/Feature/{ => COX}/GetInventoryServerFunctionToolTest.php (100%) rename tests/Feature/{ => FiveM}/GenerateManifestToolTest.php (100%) rename tests/Feature/{ => FiveM}/GenerateResourceBoilerplateToolTest.php (100%) rename tests/Feature/{ => FiveM}/GetEventClientReferenceToolTest.php (100%) rename tests/Feature/{ => FiveM}/GetEventServerReferenceToolTest.php (100%) rename tests/Feature/{ => FiveM}/GetNativeClientFunctionToolTest.php (100%) rename tests/Feature/{ => FiveM}/GetNativeServerFunctionToolTest.php (100%) rename tests/Feature/{ => FiveM}/SearchFivemdocsToolTest.php (100%) rename tests/Feature/{ => QBCore}/GetQBCoreClientEventReferenceToolTest.php (100%) rename tests/Feature/{ => QBCore}/GetQBCoreClientFunctionToolTest.php (100%) rename tests/Feature/{ => QBCore}/GetQBCoreConfigToolTest.php (100%) rename tests/Feature/{ => QBCore}/GetQBCorePlayersToolTest.php (100%) create mode 100644 tests/Feature/QBCore/GetQBCoreResourceListToolTest.php create mode 100644 tests/Feature/QBCore/GetQBCoreResourceReferenceToolTest.php rename tests/Feature/{ => QBCore}/GetQBCoreServerEventReferenceToolTest.php (100%) rename tests/Feature/{ => QBCore}/GetQBCoreServerFunctionToolTest.php (100%) rename tests/Feature/{ => QBCore}/GetQBCoreSharedDataToolTest.php (100%) diff --git a/app/Mcp/Servers/FiveMServer.php b/app/Mcp/Servers/FiveMServer.php index 23f1eb9..348b173 100644 --- a/app/Mcp/Servers/FiveMServer.php +++ b/app/Mcp/Servers/FiveMServer.php @@ -26,6 +26,8 @@ use App\Mcp\Tools\QBCore\Client\GetQBCoreClientEventReference; use App\Mcp\Tools\QBCore\Client\GetQBCoreClientFunction; use App\Mcp\Tools\QBCore\GetQBCoreConfig; use App\Mcp\Tools\QBCore\GetQBCorePlayers; +use App\Mcp\Tools\QBCore\GetQBCoreResourceList; +use App\Mcp\Tools\QBCore\GetQBCoreResourceReference; use App\Mcp\Tools\QBCore\GetQBCoreSharedData; use App\Mcp\Tools\QBCore\Server\GetQBCoreServerEventReference; use App\Mcp\Tools\QBCore\Server\GetQBCoreServerFunction; @@ -66,6 +68,8 @@ class FiveMServer extends Server GetQBCoreSharedData::class, GetQBCoreConfig::class, GetQBCorePlayers::class, + GetQBCoreResourceList::class, + GetQBCoreResourceReference::class, GetCOXEventReference::class, GetCOXFunction::class, GetInventoryServerFunction::class, diff --git a/app/Mcp/Tools/QBCore/GetQBCoreResourceList.php b/app/Mcp/Tools/QBCore/GetQBCoreResourceList.php new file mode 100644 index 0000000..4fed3d2 --- /dev/null +++ b/app/Mcp/Tools/QBCore/GetQBCoreResourceList.php @@ -0,0 +1,500 @@ +get('category'); + $resources = $this->getAllResources($category); + + return Response::text($this->formatResourceList($resources)); + } + + /** + * Get all QBCore resources, optionally filtered by category. + */ + protected function getAllResources(?string $category = null): array + { + $allResources = [ + // Admin & Management + 'qb-adminmenu' => [ + 'name' => 'qb-adminmenu', + 'title' => 'Admin Menu', + 'category' => 'Admin & Management', + 'description' => 'Admin panel for server management with player controls, moderation, warnings, and coordinate tools', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-adminmenu', + ], + + // Jobs + 'qb-ambulancejob' => [ + 'name' => 'qb-ambulancejob', + 'title' => 'Ambulance Job', + 'category' => 'Jobs', + 'description' => 'Medical job with hospital check-in, damage/bleeding system, and patient revival mechanics', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-ambulancejob', + ], + 'qb-busjob' => [ + 'name' => 'qb-busjob', + 'title' => 'Bus Job', + 'category' => 'Jobs', + 'description' => 'Public transportation job for bus drivers with route and payment system', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-busjob', + ], + 'qb-garbagejob' => [ + 'name' => 'qb-garbagejob', + 'title' => 'Garbage Job', + 'category' => 'Jobs', + 'description' => 'Garbage collection job with pickup routes and payment system', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-garbagejob', + ], + 'qb-hotdogjob' => [ + 'name' => 'qb-hotdogjob', + 'title' => 'Hot Dog Job', + 'category' => 'Jobs', + 'description' => 'Hot dog stand vendor job with payment system', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-hotdogjob', + ], + 'qb-mechanicjob' => [ + 'name' => 'qb-mechanicjob', + 'title' => 'Mechanic Job', + 'category' => 'Jobs', + 'description' => 'Vehicle repair and customization job with parts system', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-mechanicjob', + ], + 'qb-newsjob' => [ + 'name' => 'qb-newsjob', + 'title' => 'News Job', + 'category' => 'Jobs', + 'description' => 'News reporter job with interviews and broadcast system', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-newsjob', + ], + 'qb-policejob' => [ + 'name' => 'qb-policejob', + 'title' => 'Police Job', + 'category' => 'Jobs', + 'description' => 'Law enforcement job with dispatch, arrest, jailing, and evidence system', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-policejob', + ], + 'qb-recyclejob' => [ + 'name' => 'qb-recyclejob', + 'title' => 'Recycle Job', + 'category' => 'Jobs', + 'description' => 'Recycling center worker job with item pickup and crafting', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-recyclejob', + ], + 'qb-taxijob' => [ + 'name' => 'qb-taxijob', + 'title' => 'Taxi Job', + 'category' => 'Jobs', + 'description' => 'Taxi driver job with passenger pickup and payment system', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-taxijob', + ], + 'qb-towjob' => [ + 'name' => 'qb-towjob', + 'title' => 'Tow Job', + 'category' => 'Jobs', + 'description' => 'Vehicle towing service with impound and payment system', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-towjob', + ], + 'qb-truckerjob' => [ + 'name' => 'qb-truckerjob', + 'title' => 'Trucker Job', + 'category' => 'Jobs', + 'description' => 'Long-haul trucking job with delivery routes and payment', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-truckerjob', + ], + + // Crime & Robberies + 'qb-bankrobbery' => [ + 'name' => 'qb-bankrobbery', + 'title' => 'Bank Robbery', + 'category' => 'Crime & Robberies', + 'description' => 'Heist job with thermal drill, hacking, and loot system', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-bankrobbery', + ], + 'qb-drugs' => [ + 'name' => 'qb-drugs', + 'title' => 'Drug Dealing', + 'category' => 'Crime & Robberies', + 'description' => 'Drug production and dealing system with supply and demand', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-drugs', + ], + 'qb-houserobbery' => [ + 'name' => 'qb-houserobbery', + 'title' => 'House Robbery', + 'category' => 'Crime & Robberies', + 'description' => 'Residential burglary system with lockpicking and loot', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-houserobbery', + ], + 'qb-jewelry' => [ + 'name' => 'qb-jewelry', + 'title' => 'Jewelry Store Robbery', + 'category' => 'Crime & Robberies', + 'description' => 'Jewelry store heist with thermite drill and loot system', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-jewelry', + ], + 'qb-storerobbery' => [ + 'name' => 'qb-storerobbery', + 'title' => 'Store Robbery', + 'category' => 'Crime & Robberies', + 'description' => 'Convenience store robbery with holdup mechanics', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-storerobbery', + ], + 'qb-truckrobbery' => [ + 'name' => 'qb-truckrobbery', + 'title' => 'Truck Robbery', + 'category' => 'Crime & Robberies', + 'description' => 'Armored truck heist with combat and loot mechanics', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-truckrobbery', + ], + 'qb-weed' => [ + 'name' => 'qb-weed', + 'title' => 'Weed Growing', + 'category' => 'Crime & Robberies', + 'description' => 'Marijuana cultivation and harvesting system', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-weed', + ], + 'qb-vineyard' => [ + 'name' => 'qb-vineyard', + 'title' => 'Vineyard', + 'category' => 'Crime & Robberies', + 'description' => 'Grape harvesting and wine production system', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-vineyard', + ], + + // Housing & Interiors + 'qb-apartments' => [ + 'name' => 'qb-apartments', + 'title' => 'Apartments', + 'category' => 'Housing & Interiors', + 'description' => 'Player apartment rental and management system', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-apartments', + ], + 'qb-houses' => [ + 'name' => 'qb-houses', + 'title' => 'Houses', + 'category' => 'Housing & Interiors', + 'description' => 'Player house ownership with storage and customization', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-houses', + ], + 'qb-interior' => [ + 'name' => 'qb-interior', + 'title' => 'Interior', + 'category' => 'Housing & Interiors', + 'description' => 'Interior world system for building custom rooms', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-interior', + ], + + // Vehicles & Transportation + 'qb-garages' => [ + 'name' => 'qb-garages', + 'title' => 'Garages', + 'category' => 'Vehicles & Transportation', + 'description' => 'Vehicle parking and retrieval system with multiple garages', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-garages', + ], + 'qb-vehiclekeys' => [ + 'name' => 'qb-vehiclekeys', + 'title' => 'Vehicle Keys', + 'category' => 'Vehicles & Transportation', + 'description' => 'Vehicle ownership and key distribution system', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-vehiclekeys', + ], + 'qb-vehiclesales' => [ + 'name' => 'qb-vehiclesales', + 'title' => 'Vehicle Sales', + 'category' => 'Vehicles & Transportation', + 'description' => 'Vehicle dealership system for buying and trading vehicles', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-vehiclesales', + ], + 'qb-vehicleshop' => [ + 'name' => 'qb-vehicleshop', + 'title' => 'Vehicle Shop', + 'category' => 'Vehicles & Transportation', + 'description' => 'Show room for purchasing new vehicles', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-vehicleshop', + ], + 'qb-fuel' => [ + 'name' => 'qb-fuel', + 'title' => 'Fuel System', + 'category' => 'Vehicles & Transportation', + 'description' => 'Vehicle fueling system with gas stations', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-fuel', + ], + + // Commerce & Markets + 'qb-banking' => [ + 'name' => 'qb-banking', + 'title' => 'Banking', + 'category' => 'Commerce & Markets', + 'description' => 'Bank account system with deposits, withdrawals, and transfers', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-banking', + ], + 'qb-cityhall' => [ + 'name' => 'qb-cityhall', + 'title' => 'City Hall', + 'category' => 'Commerce & Markets', + 'description' => 'Government records and ID system for players', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-cityhall', + ], + 'qb-clothing' => [ + 'name' => 'qb-clothing', + 'title' => 'Clothing Shop', + 'category' => 'Commerce & Markets', + 'description' => 'Clothing store system for outfit customization', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-clothing', + ], + 'qb-crypto' => [ + 'name' => 'qb-crypto', + 'title' => 'Cryptocurrency', + 'category' => 'Commerce & Markets', + 'description' => 'Cryptocurrency trading platform system', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-crypto', + ], + 'qb-pawnshop' => [ + 'name' => 'qb-pawnshop', + 'title' => 'Pawn Shop', + 'category' => 'Commerce & Markets', + 'description' => 'Pawn shop for selling and buying items', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-pawnshop', + ], + 'qb-shops' => [ + 'name' => 'qb-shops', + 'title' => 'Shops', + 'category' => 'Commerce & Markets', + 'description' => 'General-purpose shop system for generic stores', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-shops', + ], + + // Player Systems + 'qb-inventory' => [ + 'name' => 'qb-inventory', + 'title' => 'Inventory', + 'category' => 'Player Systems', + 'description' => 'Player item inventory management system', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-inventory', + ], + 'qb-management' => [ + 'name' => 'qb-management', + 'title' => 'Management', + 'category' => 'Player Systems', + 'description' => 'Org/faction/job management system for player hierarchies', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-management', + ], + 'qb-multicharacter' => [ + 'name' => 'qb-multicharacter', + 'title' => 'Multi-Character', + 'category' => 'Player Systems', + 'description' => 'Multiple character selection and management on login', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-multicharacter', + ], + 'qb-phone' => [ + 'name' => 'qb-phone', + 'title' => 'Phone', + 'category' => 'Player Systems', + 'description' => 'In-game phone system with apps, messages, and calls', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-phone', + ], + 'qb-prison' => [ + 'name' => 'qb-prison', + 'title' => 'Prison', + 'category' => 'Player Systems', + 'description' => 'Prison system for jailed players with tasks and release', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-prison', + ], + 'qb-spawn' => [ + 'name' => 'qb-spawn', + 'title' => 'Spawn', + 'category' => 'Player Systems', + 'description' => 'Initial spawn location selector for new players', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-spawn', + ], + 'qb-fitbit' => [ + 'name' => 'qb-fitbit', + 'title' => 'Fitbit', + 'category' => 'Player Systems', + 'description' => 'Health and fitness tracking wearable device', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-fitbit', + ], + + // UI & Interface + 'qb-hud' => [ + 'name' => 'qb-hud', + 'title' => 'HUD', + 'category' => 'UI & Interface', + 'description' => 'Main heads-up display for player information', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-hud', + ], + 'qb-input' => [ + 'name' => 'qb-input', + 'title' => 'Input', + 'category' => 'UI & Interface', + 'description' => 'Generic input dialog system for NUI popups', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-input', + ], + 'qb-loading' => [ + 'name' => 'qb-loading', + 'title' => 'Loading Screen', + 'category' => 'UI & Interface', + 'description' => 'Animated loading screen on server startup', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-loading', + ], + 'qb-menu' => [ + 'name' => 'qb-menu', + 'title' => 'Menu', + 'category' => 'UI & Interface', + 'description' => 'Simple menu UI system for player interactions', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-menu', + ], + 'qb-radialmenu' => [ + 'name' => 'qb-radialmenu', + 'title' => 'Radial Menu', + 'category' => 'UI & Interface', + 'description' => 'Radial/circular menu interface for quick selections', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-radialmenu', + ], + 'qb-scoreboard' => [ + 'name' => 'qb-scoreboard', + 'title' => 'Scoreboard', + 'category' => 'UI & Interface', + 'description' => 'Server player list and information scoreboard', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-scoreboard', + ], + 'qb-target' => [ + 'name' => 'qb-target', + 'title' => 'Target System', + 'category' => 'UI & Interface', + 'description' => 'NPC and object targeting system for interactions', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-target', + ], + + // Entertainment & Activities + 'qb-diving' => [ + 'name' => 'qb-diving', + 'title' => 'Diving', + 'category' => 'Entertainment & Activities', + 'description' => 'Underwater treasure hunting activity', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-diving', + ], + 'qb-lapraces' => [ + 'name' => 'qb-lapraces', + 'title' => 'Lap Races', + 'category' => 'Entertainment & Activities', + 'description' => 'Racing competition system with lap tracking', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-lapraces', + ], + 'qb-minigames' => [ + 'name' => 'qb-minigames', + 'title' => 'Minigames', + 'category' => 'Entertainment & Activities', + 'description' => 'Collection of minigames for lockpicking, hacking, etc.', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-minigames', + ], + 'qb-radio' => [ + 'name' => 'qb-radio', + 'title' => 'Radio', + 'category' => 'Entertainment & Activities', + 'description' => 'In-vehicle or ambient radio station system', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-radio', + ], + 'qb-streetraces' => [ + 'name' => 'qb-streetraces', + 'title' => 'Street Races', + 'category' => 'Entertainment & Activities', + 'description' => 'Street racing event system with records', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-streetraces', + ], + + // Utilities & Miscellaneous + 'qb-doorlock' => [ + 'name' => 'qb-doorlock', + 'title' => 'Door Lock', + 'category' => 'Utilities & Miscellaneous', + 'description' => 'Door locking system with access control', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-doorlock', + ], + 'qb-scrapyard' => [ + 'name' => 'qb-scrapyard', + 'title' => 'Scrap Yard', + 'category' => 'Utilities & Miscellaneous', + 'description' => 'Vehicle scrapping system for parts and money', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-scrapyard', + ], + 'qb-smallresources' => [ + 'name' => 'qb-smallresources', + 'title' => 'Small Resources', + 'category' => 'Utilities & Miscellaneous', + 'description' => 'Bundle of small utility resources for various features', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-smallresources', + ], + 'qb-weapons' => [ + 'name' => 'qb-weapons', + 'title' => 'Weapons', + 'category' => 'Utilities & Miscellaneous', + 'description' => 'Weapon shop and ammo purchasing system', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-weapons', + ], + 'qb-weathersync' => [ + 'name' => 'qb-weathersync', + 'title' => 'Weather Sync', + 'category' => 'Utilities & Miscellaneous', + 'description' => 'Server-wide weather synchronization system', + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-weathersync', + ], + ]; + + if ($category) { + return array_filter($allResources, fn ($r) => strtolower($r['category']) === strtolower($category)); + } + + return $allResources; + } + + /** + * Format the resource list. + */ + protected function formatResourceList(array $resources): string + { + return view('mcp.qbcore.qbcore-resource-list', [ + 'resources' => $resources, + ])->render(); + } + + /** + * Get the tool's input schema. + * + * @return array + */ + public function schema(JsonSchema $schema): array + { + return [ + 'category' => $schema + ->string() + ->description('Optional: Filter resources by category (Admin & Management, Jobs, Crime & Robberies, Housing & Interiors, Vehicles & Transportation, Commerce & Markets, Player Systems, UI & Interface, Entertainment & Activities, Utilities & Miscellaneous)') + ->enum([ + 'Admin & Management', + 'Jobs', + 'Crime & Robberies', + 'Housing & Interiors', + 'Vehicles & Transportation', + 'Commerce & Markets', + 'Player Systems', + 'UI & Interface', + 'Entertainment & Activities', + 'Utilities & Miscellaneous', + ]), + ]; + } +} diff --git a/app/Mcp/Tools/QBCore/GetQBCoreResourceReference.php b/app/Mcp/Tools/QBCore/GetQBCoreResourceReference.php new file mode 100644 index 0000000..7801a4d --- /dev/null +++ b/app/Mcp/Tools/QBCore/GetQBCoreResourceReference.php @@ -0,0 +1,325 @@ +get('resource_name'); + + $resource = $this->findResource($resourceName); + + if (! $resource) { + return Response::text(sprintf("QBCore resource '%s' not found. Use GetQBCoreResourceList to see all available resources.", $resourceName)); + } + + return Response::text($this->formatResourceReference($resource)); + } + + /** + * Find a QBCore resource by name. + */ + protected function findResource(string $name): ?array + { + $resources = [ + 'qb-adminmenu' => [ + 'name' => 'qb-adminmenu', + 'title' => 'Admin Menu', + 'category' => 'Admin & Management', + 'description' => 'Admin panel for server management and player moderation.', + 'features' => ['Player Management', 'Moderation', 'Coordinate Tools', 'Announcements', 'Reports', 'Warnings'], + 'commands' => [ + '/admin' => 'Opens the admin menu', + '/blips' => 'Toggles player blips', + '/names' => 'Toggles player names display', + '/coords' => 'Shows your current coordinates', + '/maxmods' => 'Sets vehicle to max mods', + '/noclip' => 'Toggles noclip mode', + '/admincar' => 'Adds current vehicle to garage', + '/announce [message]' => 'Creates an announcement', + '/report [message]' => 'Create a report to staff', + '/reportr [message]' => 'Replies to a user report', + '/reporttoggle' => 'Opt in/out of receiving player reports', + '/staffchat [message]' => 'Sends a staff-only message', + '/warn [id] [reason]' => 'Warn a player', + '/checkwarns [id] [opt: number]' => 'View warnings for a player', + '/delwarn [id] [number]' => 'Delete a warning from a player', + '/givenuifocus [id] [hasFocus] [hasCursor]' => 'Sets nuifocus state for player', + '/setmodel [model] [id]' => 'Changes the players ped model', + '/setspeed [opt: speed]' => 'Sets players foot speed', + '/kickall' => 'Kick all players from server', + '/setammo [amount] [opt: weapon]' => 'Set weapon ammo', + '/vector2' => 'Copies vector2 to clipboard', + '/vector3' => 'Copies vector3 to clipboard', + '/vector4' => 'Copies vector4 to clipboard', + '/heading' => 'Copies heading to clipboard', + ], + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-adminmenu', + ], + + 'qb-ambulancejob' => [ + 'name' => 'qb-ambulancejob', + 'title' => 'Ambulance Job', + 'category' => 'Jobs', + 'description' => 'Medical job with hospital check-in system, damage/bleeding mechanics, and patient revival.', + 'features' => ['Hospital Check-in System', 'Damage Tracking', 'Bleeding System', 'Patient Revival', 'Job Shop', 'Vehicle Spawner'], + 'commands' => [ + '/911e [message]' => 'Sends a message to EMS', + '/status' => 'Check the status of the nearest player', + '/heal' => 'Heals the nearest player', + '/revivep' => 'Revives the nearest player', + '/revive' => 'Revive yourself', + '/setpain [opt: id]' => 'Sets the pain level', + '/kill [opt: id]' => 'Kills the player', + '/aheal [opt: id]' => 'Heals a player', + ], + 'items' => [ + 'ifaks' => 'Relieves player stress and heals them by +10', + 'bandage' => 'Heals player by +10 and has 50% chance of removing 1 level of bleeding', + 'firstaid' => 'Completely heals closest player as long as they are in last-stand', + 'painkillers' => 'Stops bleeding temporarily but wears off over time', + ], + 'events' => [ + 'hospital:server:SetDeathStatus' => 'Modify the players isdead metadata', + 'hospital:server:SetLaststandStatus' => 'Modify the players inlaststand metadata', + 'hospital:server:ambulanceAlert' => 'Send a notification to all EMTs', + 'hospital:server:RevivePlayer' => 'Revive a player for free or a fee', + ], + 'callbacks' => [ + 'hospital:GetDoctors' => 'Returns the number of players online with the ambulance job', + ], + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-ambulancejob', + ], + + 'qb-banking' => [ + 'name' => 'qb-banking', + 'title' => 'Banking', + 'category' => 'Commerce & Markets', + 'description' => 'Bank account system with deposits, withdrawals, and transfers between players.', + 'features' => ['Account Management', 'Money Transfer', 'Transaction History', 'ATM Withdrawals'], + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-banking', + ], + + 'qb-inventory' => [ + 'name' => 'qb-inventory', + 'title' => 'Inventory', + 'category' => 'Player Systems', + 'description' => 'Player item inventory management system with weight-based limits.', + 'features' => ['Item Management', 'Weight Limits', 'Inventory UI', 'Drop Items', 'Trade Items'], + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-inventory', + ], + + 'qb-phone' => [ + 'name' => 'qb-phone', + 'title' => 'Phone', + 'category' => 'Player Systems', + 'description' => 'In-game phone system with apps, messages, calls, and notifications.', + 'features' => ['Messaging', 'Phone Calls', 'Apps System', 'Contacts', 'Photos', 'Radio'], + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-phone', + ], + + 'qb-policejob' => [ + 'name' => 'qb-policejob', + 'title' => 'Police Job', + 'category' => 'Jobs', + 'description' => 'Law enforcement job with dispatch, arrest, jailing, and evidence system.', + 'features' => ['Dispatch System', 'Arrests', 'Jail Management', 'Evidence Collection', 'Vehicle Impound'], + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-policejob', + ], + + 'qb-garages' => [ + 'name' => 'qb-garages', + 'title' => 'Garages', + 'category' => 'Vehicles & Transportation', + 'description' => 'Vehicle parking and retrieval system with multiple garage locations.', + 'features' => ['Multiple Garages', 'Vehicle Storage', 'Quick Parking', 'Vehicle Retrieval'], + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-garages', + ], + + 'qb-shops' => [ + 'name' => 'qb-shops', + 'title' => 'Shops', + 'category' => 'Commerce & Markets', + 'description' => 'General-purpose shop system for creating generic stores.', + 'features' => ['Shop Creation', 'Item Pricing', 'Purchase System', 'Multiple Locations'], + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-shops', + ], + + 'qb-target' => [ + 'name' => 'qb-target', + 'title' => 'Target System', + 'category' => 'UI & Interface', + 'description' => 'NPC and object targeting system for player interactions.', + 'features' => ['Click Targeting', 'NPC Interaction', 'Object Targeting', 'Distance Based'], + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-target', + ], + + 'qb-hud' => [ + 'name' => 'qb-hud', + 'title' => 'HUD', + 'category' => 'UI & Interface', + 'description' => 'Main heads-up display showing player information and status.', + 'features' => ['Health Display', 'Armor Display', 'Hunger/Thirst', 'Stress Level', 'Mini Map'], + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-hud', + ], + + 'qb-doorlock' => [ + 'name' => 'qb-doorlock', + 'title' => 'Door Lock', + 'category' => 'Utilities & Miscellaneous', + 'description' => 'Door locking system with access control and permissions.', + 'features' => ['Door Locking', 'Access Control', 'Job Locks', 'Gang Locks'], + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-doorlock', + ], + + 'qb-mechanicjob' => [ + 'name' => 'qb-mechanicjob', + 'title' => 'Mechanic Job', + 'category' => 'Jobs', + 'description' => 'Vehicle repair and customization job with parts system.', + 'features' => ['Vehicle Repair', 'Vehicle Customization', 'Parts Management', 'Customer Jobs'], + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-mechanicjob', + ], + + 'qb-housing' => [ + 'name' => 'qb-houses', + 'title' => 'Houses', + 'category' => 'Housing & Interiors', + 'description' => 'Player house ownership with storage and customization.', + 'features' => ['House Purchase', 'House Storage', 'Furniture Customization', 'Multi-Garage'], + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-houses', + ], + + 'qb-prison' => [ + 'name' => 'qb-prison', + 'title' => 'Prison', + 'category' => 'Player Systems', + 'description' => 'Prison system for jailed players with tasks and release.', + 'features' => ['Jailing System', 'Prison Jobs', 'Release System', 'Time Tracking'], + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-prison', + ], + + 'qb-bankrobbery' => [ + 'name' => 'qb-bankrobbery', + 'title' => 'Bank Robbery', + 'category' => 'Crime & Robberies', + 'description' => 'Heist job with thermal drill, hacking, and loot system.', + 'features' => ['Thermal Drill', 'Hacking Minigame', 'Loot System', 'Police Alerts'], + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-bankrobbery', + ], + + 'qb-drugs' => [ + 'name' => 'qb-drugs', + 'title' => 'Drug Dealing', + 'category' => 'Crime & Robberies', + 'description' => 'Drug production and dealing system with supply and demand.', + 'features' => ['Drug Production', 'Dealing Mechanics', 'Supply/Demand', 'Dealer Routes'], + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-drugs', + ], + + 'qb-fuel' => [ + 'name' => 'qb-fuel', + 'title' => 'Fuel System', + 'category' => 'Vehicles & Transportation', + 'description' => 'Vehicle fueling system with gas stations.', + 'features' => ['Gas Stations', 'Fuel Usage', 'Cost Calculation', 'Player Jobs'], + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-fuel', + ], + + 'qb-multicharacter' => [ + 'name' => 'qb-multicharacter', + 'title' => 'Multi-Character', + 'category' => 'Player Systems', + 'description' => 'Multiple character selection and management on login.', + 'features' => ['Character Creation', 'Character Selection', 'Character Deletion'], + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-multicharacter', + ], + + 'qb-clothing' => [ + 'name' => 'qb-clothing', + 'title' => 'Clothing Shop', + 'category' => 'Commerce & Markets', + 'description' => 'Clothing store system for outfit customization.', + 'features' => ['Outfit Customization', 'Clothing Purchase', 'Clothing Categories'], + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-clothing', + ], + + 'qb-vehicleshop' => [ + 'name' => 'qb-vehicleshop', + 'title' => 'Vehicle Shop', + 'category' => 'Vehicles & Transportation', + 'description' => 'Show room for purchasing new vehicles.', + 'features' => ['Vehicle Showcase', 'Vehicle Purchase', 'Test Drive'], + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-vehicleshop', + ], + + 'qb-input' => [ + 'name' => 'qb-input', + 'title' => 'Input', + 'category' => 'UI & Interface', + 'description' => 'Generic input dialog system for NUI popups.', + 'features' => ['Text Input', 'Number Input', 'Validation', 'Custom Styling'], + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-input', + ], + + 'qb-manage' => [ + 'name' => 'qb-management', + 'title' => 'Management', + 'category' => 'Player Systems', + 'description' => 'Org/faction/job management for player hierarchies.', + 'features' => ['Rank Management', 'Member Management', 'Permission Control'], + 'url' => 'https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-management', + ], + ]; + + // Normalize the resource name for matching + $normalized = strtolower(str_replace(['_', ' '], '-', $name)); + // Remove any prefix variations and ensure qb- prefix + $normalized = preg_replace('/^(qbcore[-_]?)?/i', '', $normalized); + $normalized = 'qb-'.ltrim($normalized, 'qb-'); + + foreach ($resources as $resource) { + if (strtolower($resource['name']) === $normalized) { + return $resource; + } + } + + return null; + } + + /** + * Format the resource reference. + */ + protected function formatResourceReference(array $resource): string + { + return view('mcp.qbcore.qbcore-resource-reference', [ + 'resource' => $resource, + ])->render(); + } + + /** + * Get the tool's input schema. + * + * @return array + */ + public function schema(JsonSchema $schema): array + { + return [ + 'resource_name' => $schema + ->string() + ->description('The name of the QBCore resource to look up (e.g., qb-ambulancejob, qb-adminmenu, qb-inventory)') + ->required(), + ]; + } +} diff --git a/resources/views/mcp/qbcore/qbcore-resource-list.blade.php b/resources/views/mcp/qbcore/qbcore-resource-list.blade.php new file mode 100644 index 0000000..3bc9f1d --- /dev/null +++ b/resources/views/mcp/qbcore/qbcore-resource-list.blade.php @@ -0,0 +1,25 @@ +## QBCore Resources Directory + +Complete list of all {{ count($resources) }} official QBCore resources. Use `GetQBCoreResourceReference` to get detailed information about specific resources. + +@php + $grouped = collect($resources)->groupBy('category'); +@endphp + +@foreach($grouped as $category => $categoryResources) +### {{ $category }} + +| Resource | Description | Documentation | +|----------|-------------|-----------------| +@foreach($categoryResources as $resource) +| **{{ $resource['title'] }}** (`{{ $resource['name'] }}`) | {{ $resource['description'] }} | [View Docs]({{ $resource['url'] }}) | +@endforeach + +@endforeach + +### Quick Links +- [QBCore Framework GitHub](https://github.com/qbcore-framework) +- [QBCore Documentation](https://docs.qbcore.org) +- [QBCore Discord Community](https://discord.gg/qbcore) + +**Total Resources:** {{ count($resources) }} diff --git a/resources/views/mcp/qbcore/qbcore-resource-reference.blade.php b/resources/views/mcp/qbcore/qbcore-resource-reference.blade.php new file mode 100644 index 0000000..de9ab2a --- /dev/null +++ b/resources/views/mcp/qbcore/qbcore-resource-reference.blade.php @@ -0,0 +1,64 @@ +## {{ $resource['title'] }} (`{{ $resource['name'] }}`) + +**Category:** {!! $resource['category'] !!} + +{{ $resource['description'] }} + +### Overview + +{{ $resource['description'] }} + +@if(isset($resource['features']) && !empty($resource['features'])) +#### Key Features +@foreach($resource['features'] as $feature) +- {{ $feature }} +@endforeach +@endif + +@if(isset($resource['commands']) && !empty($resource['commands'])) +### Commands + +@foreach($resource['commands'] as $command => $description) +#### `{{ $command }}` +{{ $description }} + +@endforeach +@endif + +@if(isset($resource['events']) && !empty($resource['events'])) +### Events + +@foreach($resource['events'] as $event => $description) +#### `{{ $event }}` +{{ $description }} + +@endforeach +@endif + +@if(isset($resource['callbacks']) && !empty($resource['callbacks'])) +### Callbacks + +@foreach($resource['callbacks'] as $callback => $description) +#### `{{ $callback }}` +{{ $description }} + +@endforeach +@endif + +@if(isset($resource['items']) && !empty($resource['items'])) +### Items + +| Item | Description | +|------|-------------| +@foreach($resource['items'] as $item => $description) +| `{{ $item }}` | {{ $description }} | +@endforeach +@endif + +### Documentation +- [Resource Documentation]({{ $resource['url'] }}) +- [QBCore Framework](https://docs.qbcore.org) +- [GitHub Repository](https://github.com/qbcore-framework) + +**Learn More:** +To get detailed configuration options and advanced usage, visit the [full documentation]({{ $resource['url'] }}) for this resource. diff --git a/tests/Feature/GetCOXEventReferenceToolTest.php b/tests/Feature/COX/GetCOXEventReferenceToolTest.php similarity index 100% rename from tests/Feature/GetCOXEventReferenceToolTest.php rename to tests/Feature/COX/GetCOXEventReferenceToolTest.php diff --git a/tests/Feature/GetCOXFunctionToolTest.php b/tests/Feature/COX/GetCOXFunctionToolTest.php similarity index 100% rename from tests/Feature/GetCOXFunctionToolTest.php rename to tests/Feature/COX/GetCOXFunctionToolTest.php diff --git a/tests/Feature/GetInventoryClientFunctionToolTest.php b/tests/Feature/COX/GetInventoryClientFunctionToolTest.php similarity index 100% rename from tests/Feature/GetInventoryClientFunctionToolTest.php rename to tests/Feature/COX/GetInventoryClientFunctionToolTest.php diff --git a/tests/Feature/GetInventoryServerFunctionToolTest.php b/tests/Feature/COX/GetInventoryServerFunctionToolTest.php similarity index 100% rename from tests/Feature/GetInventoryServerFunctionToolTest.php rename to tests/Feature/COX/GetInventoryServerFunctionToolTest.php diff --git a/tests/Feature/GenerateManifestToolTest.php b/tests/Feature/FiveM/GenerateManifestToolTest.php similarity index 100% rename from tests/Feature/GenerateManifestToolTest.php rename to tests/Feature/FiveM/GenerateManifestToolTest.php diff --git a/tests/Feature/GenerateResourceBoilerplateToolTest.php b/tests/Feature/FiveM/GenerateResourceBoilerplateToolTest.php similarity index 100% rename from tests/Feature/GenerateResourceBoilerplateToolTest.php rename to tests/Feature/FiveM/GenerateResourceBoilerplateToolTest.php diff --git a/tests/Feature/GetEventClientReferenceToolTest.php b/tests/Feature/FiveM/GetEventClientReferenceToolTest.php similarity index 100% rename from tests/Feature/GetEventClientReferenceToolTest.php rename to tests/Feature/FiveM/GetEventClientReferenceToolTest.php diff --git a/tests/Feature/GetEventServerReferenceToolTest.php b/tests/Feature/FiveM/GetEventServerReferenceToolTest.php similarity index 100% rename from tests/Feature/GetEventServerReferenceToolTest.php rename to tests/Feature/FiveM/GetEventServerReferenceToolTest.php diff --git a/tests/Feature/GetNativeClientFunctionToolTest.php b/tests/Feature/FiveM/GetNativeClientFunctionToolTest.php similarity index 100% rename from tests/Feature/GetNativeClientFunctionToolTest.php rename to tests/Feature/FiveM/GetNativeClientFunctionToolTest.php diff --git a/tests/Feature/GetNativeServerFunctionToolTest.php b/tests/Feature/FiveM/GetNativeServerFunctionToolTest.php similarity index 100% rename from tests/Feature/GetNativeServerFunctionToolTest.php rename to tests/Feature/FiveM/GetNativeServerFunctionToolTest.php diff --git a/tests/Feature/SearchFivemdocsToolTest.php b/tests/Feature/FiveM/SearchFivemdocsToolTest.php similarity index 100% rename from tests/Feature/SearchFivemdocsToolTest.php rename to tests/Feature/FiveM/SearchFivemdocsToolTest.php diff --git a/tests/Feature/GetQBCoreClientEventReferenceToolTest.php b/tests/Feature/QBCore/GetQBCoreClientEventReferenceToolTest.php similarity index 100% rename from tests/Feature/GetQBCoreClientEventReferenceToolTest.php rename to tests/Feature/QBCore/GetQBCoreClientEventReferenceToolTest.php diff --git a/tests/Feature/GetQBCoreClientFunctionToolTest.php b/tests/Feature/QBCore/GetQBCoreClientFunctionToolTest.php similarity index 100% rename from tests/Feature/GetQBCoreClientFunctionToolTest.php rename to tests/Feature/QBCore/GetQBCoreClientFunctionToolTest.php diff --git a/tests/Feature/GetQBCoreConfigToolTest.php b/tests/Feature/QBCore/GetQBCoreConfigToolTest.php similarity index 100% rename from tests/Feature/GetQBCoreConfigToolTest.php rename to tests/Feature/QBCore/GetQBCoreConfigToolTest.php diff --git a/tests/Feature/GetQBCorePlayersToolTest.php b/tests/Feature/QBCore/GetQBCorePlayersToolTest.php similarity index 100% rename from tests/Feature/GetQBCorePlayersToolTest.php rename to tests/Feature/QBCore/GetQBCorePlayersToolTest.php diff --git a/tests/Feature/QBCore/GetQBCoreResourceListToolTest.php b/tests/Feature/QBCore/GetQBCoreResourceListToolTest.php new file mode 100644 index 0000000..9e20a2f --- /dev/null +++ b/tests/Feature/QBCore/GetQBCoreResourceListToolTest.php @@ -0,0 +1,132 @@ +handle($request); + $content = (string) $response->content(); + + expect($content)->toContain('QBCore Resources Directory'); + expect($content)->toContain('qb-ambulancejob'); + expect($content)->toContain('qb-adminmenu'); + expect($content)->toContain('qb-policejob'); +}); + +test('GetQBCoreResourceList contains all 58 resources', function () { + $tool = new GetQBCoreResourceList; + $request = new Request([]); + + $response = $tool->handle($request); + $content = (string) $response->content(); + + // Count resource names in the response + $resources = [ + 'qb-adminmenu', 'qb-ambulancejob', 'qb-apartments', 'qb-banking', 'qb-bankrobbery', + 'qb-busjob', 'qb-cityhall', 'qb-clothing', 'qb-crypto', 'qb-diving', + 'qb-doorlock', 'qb-drugs', 'qb-fitbit', 'qb-fuel', 'qb-garages', + 'qb-garbagejob', 'qb-hotdogjob', 'qb-houserobbery', 'qb-houses', 'qb-hud', + 'qb-input', 'qb-interior', 'qb-inventory', 'qb-jewelry', 'qb-lapraces', + 'qb-loading', 'qb-management', 'qb-mechanicjob', 'qb-menu', 'qb-minigames', + 'qb-multicharacter', 'qb-newsjob', 'qb-pawnshop', 'qb-phone', 'qb-policejob', + 'qb-prison', 'qb-radialmenu', 'qb-radio', 'qb-recyclejob', 'qb-scoreboard', + 'qb-scrapyard', 'qb-shops', 'qb-smallresources', 'qb-spawn', 'qb-storerobbery', + 'qb-streetraces', 'qb-taxijob', 'qb-towjob', 'qb-target', 'qb-truckerjob', + 'qb-truckrobbery', 'qb-vehiclekeys', 'qb-vehiclesales', 'qb-vehicleshop', 'qb-vineyard', + 'qb-weapons', 'qb-weathersync', 'qb-weed', + ]; + + foreach ($resources as $resource) { + expect($content)->toContain($resource); + } +}); + +test('GetQBCoreResourceList filters by category - Jobs', function () { + $tool = new GetQBCoreResourceList; + $request = new Request(['category' => 'Jobs']); + + $response = $tool->handle($request); + $content = (string) $response->content(); + + // Should contain job resources + expect($content)->toContain('qb-ambulancejob'); + expect($content)->toContain('qb-policejob'); + expect($content)->toContain('qb-mechanicjob'); + + // Should not contain non-job resources + expect($content)->not->toContain('## Admin & Management'); +}); + +test('GetQBCoreResourceList filters by category - Crime & Robberies', function () { + $tool = new GetQBCoreResourceList; + $request = new Request(['category' => 'Crime & Robberies']); + + $response = $tool->handle($request); + $content = (string) $response->content(); + + expect($content)->toContain('qb-bankrobbery'); + expect($content)->toContain('qb-drugs'); + expect($content)->toContain('qb-weed'); +}); + +test('GetQBCoreResourceList filters by category - Admin & Management', function () { + $tool = new GetQBCoreResourceList; + $request = new Request(['category' => 'Admin & Management']); + + $response = $tool->handle($request); + $content = (string) $response->content(); + + expect($content)->toContain('qb-adminmenu'); +}); + +test('GetQBCoreResourceList filters by category - UI & Interface', function () { + $tool = new GetQBCoreResourceList; + $request = new Request(['category' => 'UI & Interface']); + + $response = $tool->handle($request); + $content = (string) $response->content(); + + expect($content)->toContain('qb-hud'); + expect($content)->toContain('qb-menu'); + expect($content)->toContain('qb-target'); +}); + +test('GetQBCoreResourceList filters by category - Housing & Interiors', function () { + $tool = new GetQBCoreResourceList; + $request = new Request(['category' => 'Housing & Interiors']); + + $response = $tool->handle($request); + $content = (string) $response->content(); + + expect($content)->toContain('qb-apartments'); + expect($content)->toContain('qb-houses'); + expect($content)->toContain('qb-interior'); +}); + +test('GetQBCoreResourceList contains documentation links', function () { + $tool = new GetQBCoreResourceList; + $request = new Request([]); + + $response = $tool->handle($request); + $content = (string) $response->content(); + + expect($content)->toContain('https://docs.qbcore.org/qbcore-documentation/qbcore-resources/'); + expect($content)->toContain('View Docs'); +}); + +test('GetQBCoreResourceList has grouped categories', function () { + $tool = new GetQBCoreResourceList; + $request = new Request([]); + + $response = $tool->handle($request); + $content = (string) $response->content(); + + expect($content)->toContain('### Admin'); + expect($content)->toContain('### Jobs'); + expect($content)->toContain('### Crime'); + expect($content)->toContain('### Housing'); + expect($content)->toContain('### Vehicles'); +}); diff --git a/tests/Feature/QBCore/GetQBCoreResourceReferenceToolTest.php b/tests/Feature/QBCore/GetQBCoreResourceReferenceToolTest.php new file mode 100644 index 0000000..0180a06 --- /dev/null +++ b/tests/Feature/QBCore/GetQBCoreResourceReferenceToolTest.php @@ -0,0 +1,138 @@ + 'qb-ambulancejob']); + + $response = $tool->handle($request); + $content = (string) $response->content(); + + expect($content)->toContain('Ambulance Job'); + expect($content)->toContain('Hospital Check-in System'); + expect($content)->toContain('/heal'); + expect($content)->toContain('ifaks'); +}); + +test('GetQBCoreResourceReference returns admin menu details', function () { + $tool = new GetQBCoreResourceReference; + $request = new Request(['resource_name' => 'qb-adminmenu']); + + $response = $tool->handle($request); + $content = (string) $response->content(); + + expect($content)->toContain('Admin Menu'); + expect($content)->toContain('/admin'); + expect($content)->toContain('/blips'); + expect($content)->toContain('Player Management'); +}); + +test('GetQBCoreResourceReference returns hud details', function () { + $tool = new GetQBCoreResourceReference; + $request = new Request(['resource_name' => 'qb-hud']); + + $response = $tool->handle($request); + $content = (string) $response->content(); + + expect($content)->toContain('HUD'); + expect($content)->toContain('Health Display'); +}); + +test('GetQBCoreResourceReference returns inventory details', function () { + $tool = new GetQBCoreResourceReference; + $request = new Request(['resource_name' => 'qb-inventory']); + + $response = $tool->handle($request); + $content = (string) $response->content(); + + expect($content)->toContain('Inventory'); + expect($content)->toContain('Player Systems'); +}); + +test('GetQBCoreResourceReference returns phone details', function () { + $tool = new GetQBCoreResourceReference; + $request = new Request(['resource_name' => 'qb-phone']); + + $response = $tool->handle($request); + $content = (string) $response->content(); + + expect($content)->toContain('Phone'); + expect($content)->toContain('Messaging'); +}); + +test('GetQBCoreResourceReference returns police job details', function () { + $tool = new GetQBCoreResourceReference; + $request = new Request(['resource_name' => 'qb-policejob']); + + $response = $tool->handle($request); + $content = (string) $response->content(); + + expect($content)->toContain('Police Job'); + expect($content)->toContain('Dispatch System'); +}); + +test('GetQBCoreResourceReference includes documentation URL', function () { + $tool = new GetQBCoreResourceReference; + $request = new Request(['resource_name' => 'qb-adminmenu']); + + $response = $tool->handle($request); + $content = (string) $response->content(); + + expect($content)->toContain('https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-adminmenu'); +}); + +test('GetQBCoreResourceReference not found returns helpful message', function () { + $tool = new GetQBCoreResourceReference; + $request = new Request(['resource_name' => 'qb-nonexistent']); + + $response = $tool->handle($request); + $content = (string) $response->content(); + + expect($content)->toContain('not found'); + expect($content)->toContain('GetQBCoreResourceList'); +}); + +test('GetQBCoreResourceReference handles case variations', function () { + $tool = new GetQBCoreResourceReference; + $request = new Request(['resource_name' => 'QBCore-Ambulancejob']); + + $response = $tool->handle($request); + $content = (string) $response->content(); + + expect($content)->toContain('Ambulance Job'); +}); + +test('GetQBCoreResourceReference returns garages details', function () { + $tool = new GetQBCoreResourceReference; + $request = new Request(['resource_name' => 'qb-garages']); + + $response = $tool->handle($request); + $content = (string) $response->content(); + + expect($content)->toContain('Garages'); + expect($content)->toContain('Transportation'); +}); + +test('GetQBCoreResourceReference returns shops details', function () { + $tool = new GetQBCoreResourceReference; + $request = new Request(['resource_name' => 'qb-shops']); + + $response = $tool->handle($request); + $content = (string) $response->content(); + + expect($content)->toContain('Shops'); + expect($content)->toContain('Commerce'); +}); + +test('GetQBCoreResourceReference includes categories', function () { + $tool = new GetQBCoreResourceReference; + $request = new Request(['resource_name' => 'qb-target']); + + $response = $tool->handle($request); + $content = (string) $response->content(); + + expect($content)->toContain('UI & Interface'); + expect($content)->toContain('Target System'); +}); diff --git a/tests/Feature/GetQBCoreServerEventReferenceToolTest.php b/tests/Feature/QBCore/GetQBCoreServerEventReferenceToolTest.php similarity index 100% rename from tests/Feature/GetQBCoreServerEventReferenceToolTest.php rename to tests/Feature/QBCore/GetQBCoreServerEventReferenceToolTest.php diff --git a/tests/Feature/GetQBCoreServerFunctionToolTest.php b/tests/Feature/QBCore/GetQBCoreServerFunctionToolTest.php similarity index 100% rename from tests/Feature/GetQBCoreServerFunctionToolTest.php rename to tests/Feature/QBCore/GetQBCoreServerFunctionToolTest.php diff --git a/tests/Feature/GetQBCoreSharedDataToolTest.php b/tests/Feature/QBCore/GetQBCoreSharedDataToolTest.php similarity index 100% rename from tests/Feature/GetQBCoreSharedDataToolTest.php rename to tests/Feature/QBCore/GetQBCoreSharedDataToolTest.php