Add test for dynamic tools data in documentation page
This commit is contained in:
3 files changed
+119
-273
No files matched your search
@@ -2,7 +2,11 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Mcp\Servers\FiveMServer;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
use Illuminate\View\View;
|
use Illuminate\View\View;
|
||||||
|
use Laravel\Mcp\Server\Attributes\Description;
|
||||||
|
use ReflectionClass;
|
||||||
|
|
||||||
class DocsController extends Controller
|
class DocsController extends Controller
|
||||||
{
|
{
|
||||||
@@ -27,6 +31,64 @@ class DocsController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function documentation(): View
|
public function documentation(): View
|
||||||
{
|
{
|
||||||
return view('docs.documentation');
|
$serverReflection = new ReflectionClass(FiveMServer::class);
|
||||||
|
|
||||||
|
$toolsProperty = $serverReflection->getProperty('tools');
|
||||||
|
$resourcesProperty = $serverReflection->getProperty('resources');
|
||||||
|
$promptsProperty = $serverReflection->getProperty('prompts');
|
||||||
|
|
||||||
|
$toolsProperty->setAccessible(true);
|
||||||
|
$resourcesProperty->setAccessible(true);
|
||||||
|
$promptsProperty->setAccessible(true);
|
||||||
|
|
||||||
|
$defaultProperties = $serverReflection->getDefaultProperties();
|
||||||
|
|
||||||
|
$tools = $this->extractComponentDetails($defaultProperties['tools'] ?? [], 'tool');
|
||||||
|
$resources = $this->extractComponentDetails($defaultProperties['resources'] ?? [], 'resource');
|
||||||
|
$prompts = $this->extractComponentDetails($defaultProperties['prompts'] ?? [], 'prompt');
|
||||||
|
|
||||||
|
return view('docs.documentation', [
|
||||||
|
'tools' => $tools,
|
||||||
|
'resources' => $resources,
|
||||||
|
'prompts' => $prompts,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extract details from MCP components.
|
||||||
|
*/
|
||||||
|
protected function extractComponentDetails(array $components, string $type): array
|
||||||
|
{
|
||||||
|
return collect($components)->map(function ($componentClass) use ($type) {
|
||||||
|
$reflection = new ReflectionClass($componentClass);
|
||||||
|
$descriptionAttr = $reflection->getAttributes(Description::class)[0] ?? null;
|
||||||
|
$description = $descriptionAttr ? $descriptionAttr->getArguments()[0] : 'No description available';
|
||||||
|
|
||||||
|
// Get the simple class name and convert it to a readable format
|
||||||
|
$className = $reflection->getShortName();
|
||||||
|
$name = $this->formatClassName($className);
|
||||||
|
|
||||||
|
// Get category from namespace
|
||||||
|
$namespace = $reflection->getNamespaceName();
|
||||||
|
$parts = explode('\\', $namespace);
|
||||||
|
$category = $parts[count($parts) - 1] ?? 'General';
|
||||||
|
|
||||||
|
return [
|
||||||
|
'name' => $name,
|
||||||
|
'class' => $className,
|
||||||
|
'description' => $description,
|
||||||
|
'category' => $category,
|
||||||
|
'type' => $type,
|
||||||
|
];
|
||||||
|
})->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format class name to readable format.
|
||||||
|
*/
|
||||||
|
protected function formatClassName(string $className): string
|
||||||
|
{
|
||||||
|
// Convert PascalCase to Title Case with spaces
|
||||||
|
return Str::of($className)->kebab()->replace('-', ' ')->title();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -155,299 +155,69 @@
|
|||||||
<!-- Available Tools -->
|
<!-- Available Tools -->
|
||||||
<section class="mb-12">
|
<section class="mb-12">
|
||||||
<h2 class="text-2xl font-bold text-gray-900 mb-6">Available Tools</h2>
|
<h2 class="text-2xl font-bold text-gray-900 mb-6">Available Tools</h2>
|
||||||
|
<p class="text-gray-700 mb-6">
|
||||||
|
The FiveM MCP Server provides {{ count($tools) }} tools organized by category.
|
||||||
|
These tools allow AI assistants to search documentation, generate code, and lookup framework functions.
|
||||||
|
</p>
|
||||||
|
|
||||||
<!-- Tool 1: SearchFiveMDocs -->
|
@php
|
||||||
<div class="mb-8 border-l-4 border-indigo-500 pl-6">
|
$groupedTools = collect($tools)->groupBy('category');
|
||||||
<h3 class="text-xl font-semibold text-gray-900 mb-3">1. SearchFiveMDocs</h3>
|
@endphp
|
||||||
<p class="text-gray-700 mb-4">Search FiveM, QBCore, and COX MySQL documentation for specific topics.</p>
|
|
||||||
|
|
||||||
<h4 class="font-semibold text-gray-900 mb-2">Parameters:</h4>
|
@foreach ($groupedTools as $category => $categoryTools)
|
||||||
<ul class="list-disc list-inside text-gray-700 mb-4 ml-4">
|
<div class="mb-8">
|
||||||
<li><code class="bg-gray-100 px-2 py-1 rounded text-sm">query</code> (required): Search query (e.g., "events",
|
<h3 class="text-xl font-bold text-gray-800 mb-4 flex items-center">
|
||||||
"natives", "mysql", "database")</li>
|
<span class="inline-block w-1 h-6 bg-indigo-500 mr-3"></span>
|
||||||
<li><code class="bg-gray-100 px-2 py-1 rounded text-sm">category</code> (optional): Filter by category (all,
|
{{ $category }} Tools
|
||||||
scripting, natives, networking, resources, qbcore, coxdocs)</li>
|
<span class="ml-3 text-sm font-normal text-gray-500">({{ count($categoryTools) }})</span>
|
||||||
</ul>
|
</h3>
|
||||||
|
|
||||||
<h4 class="font-semibold text-gray-900 mb-2">Examples:</h4>
|
@foreach ($categoryTools as $index => $tool)
|
||||||
<pre class="bg-gray-100 rounded p-3 text-sm mb-2"><code>Search for QBCore callbacks and exports</code></pre>
|
<div class="mb-6 border-l-4 border-indigo-500 pl-6">
|
||||||
<pre class="bg-gray-100 rounded p-3 text-sm"><code>How do I query the database with COX MySQL?</code></pre>
|
<h4 class="text-lg font-semibold text-gray-900 mb-2">{{ $tool['name'] }}</h4>
|
||||||
|
<p class="text-gray-700">{{ $tool['description'] }}</p>
|
||||||
</div>
|
</div>
|
||||||
|
@endforeach
|
||||||
<!-- Tool 2: GetNativeFunction -->
|
|
||||||
<div class="mb-8 border-l-4 border-indigo-500 pl-6">
|
|
||||||
<h3 class="text-xl font-semibold text-gray-900 mb-3">2. GetNativeFunction</h3>
|
|
||||||
<p class="text-gray-700 mb-4">Look up GTA5/FiveM native functions.</p>
|
|
||||||
|
|
||||||
<h4 class="font-semibold text-gray-900 mb-2">Parameters:</h4>
|
|
||||||
<ul class="list-disc list-inside text-gray-700 mb-4 ml-4">
|
|
||||||
<li><code class="bg-gray-100 px-2 py-1 rounded text-sm">function_name</code> (required): Native function name
|
|
||||||
(e.g., "GetPlayerPed", "SetEntityCoords")</li>
|
|
||||||
<li><code class="bg-gray-100 px-2 py-1 rounded text-sm">language</code> (optional): Code example language (lua
|
|
||||||
or js)</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<h4 class="font-semibold text-gray-900 mb-2">Common Native Examples:</h4>
|
|
||||||
<ul class="list-disc list-inside text-gray-700 mb-4 ml-4">
|
|
||||||
<li>Common natives: <code class="bg-gray-100 px-2 py-1 rounded text-sm">GetPlayerPed</code>, <code
|
|
||||||
class="bg-gray-100 px-2 py-1 rounded text-sm">SetEntityCoords</code>, <code
|
|
||||||
class="bg-gray-100 px-2 py-1 rounded text-sm">GetEntityCoords</code></li>
|
|
||||||
<li>CFX natives: <code class="bg-gray-100 px-2 py-1 rounded text-sm">RegisterNetEvent</code>, <code
|
|
||||||
class="bg-gray-100 px-2 py-1 rounded text-sm">TriggerServerEvent</code>, <code
|
|
||||||
class="bg-gray-100 px-2 py-1 rounded text-sm">TriggerClientEvent</code></li>
|
|
||||||
<li>ESX: <code class="bg-gray-100 px-2 py-1 rounded text-sm">ESX.GetPlayerFromId</code></li>
|
|
||||||
<li>QBCore: <code class="bg-gray-100 px-2 py-1 rounded text-sm">QBCore.Functions.GetPlayer</code></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
|
@endforeach
|
||||||
|
|
||||||
<!-- Tool 3: GenerateManifest -->
|
|
||||||
<div class="mb-8 border-l-4 border-indigo-500 pl-6">
|
|
||||||
<h3 class="text-xl font-semibold text-gray-900 mb-3">3. GenerateManifest</h3>
|
|
||||||
<p class="text-gray-700 mb-4">Generate a fxmanifest.lua file.</p>
|
|
||||||
|
|
||||||
<h4 class="font-semibold text-gray-900 mb-2">Parameters:</h4>
|
|
||||||
<ul class="list-disc list-inside text-gray-700 mb-4 ml-4">
|
|
||||||
<li><code class="bg-gray-100 px-2 py-1 rounded text-sm">resource_name</code> (required): Resource name</li>
|
|
||||||
<li><code class="bg-gray-100 px-2 py-1 rounded text-sm">author</code> (optional): Author name</li>
|
|
||||||
<li><code class="bg-gray-100 px-2 py-1 rounded text-sm">description</code> (optional): Resource description</li>
|
|
||||||
<li><code class="bg-gray-100 px-2 py-1 rounded text-sm">version</code> (optional): Version number (default:
|
|
||||||
"1.0.0")</li>
|
|
||||||
<li><code class="bg-gray-100 px-2 py-1 rounded text-sm">script_type</code> (optional): lua or js (default: lua)
|
|
||||||
</li>
|
|
||||||
<li><code class="bg-gray-100 px-2 py-1 rounded text-sm">include_client</code> (optional): Include client scripts
|
|
||||||
(default: true)</li>
|
|
||||||
<li><code class="bg-gray-100 px-2 py-1 rounded text-sm">include_server</code> (optional): Include server scripts
|
|
||||||
(default: true)</li>
|
|
||||||
<li><code class="bg-gray-100 px-2 py-1 rounded text-sm">framework</code> (optional): standalone, esx, or qbcore
|
|
||||||
(default: standalone)</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<h4 class="font-semibold text-gray-900 mb-2">Example:</h4>
|
|
||||||
<pre
|
|
||||||
class="bg-gray-100 rounded p-3 text-sm"><code>Generate a manifest for an ESX resource called "my-shop"</code></pre>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Tool 4: GetEventReference -->
|
|
||||||
<div class="mb-8 border-l-4 border-indigo-500 pl-6">
|
|
||||||
<h3 class="text-xl font-semibold text-gray-900 mb-3">4. GetEventReference</h3>
|
|
||||||
<p class="text-gray-700 mb-4">Get information about FiveM, ESX, and QBCore events.</p>
|
|
||||||
|
|
||||||
<h4 class="font-semibold text-gray-900 mb-2">Parameters:</h4>
|
|
||||||
<ul class="list-disc list-inside text-gray-700 mb-4 ml-4">
|
|
||||||
<li><code class="bg-gray-100 px-2 py-1 rounded text-sm">event_name</code> (optional): Specific event name to
|
|
||||||
look up</li>
|
|
||||||
<li><code class="bg-gray-100 px-2 py-1 rounded text-sm">event_type</code> (optional): Filter by type (all, core,
|
|
||||||
esx, qbcore)</li>
|
|
||||||
<li><code class="bg-gray-100 px-2 py-1 rounded text-sm">language</code> (optional): Code example language (lua
|
|
||||||
or js)</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<h4 class="font-semibold text-gray-900 mb-2">Examples:</h4>
|
|
||||||
<pre class="bg-gray-100 rounded p-3 text-sm mb-2"><code>Show me all core FiveM events</code></pre>
|
|
||||||
<pre class="bg-gray-100 rounded p-3 text-sm mb-2"><code>Look up the QBCore:Client:OnPlayerLoaded event</code></pre>
|
|
||||||
<pre class="bg-gray-100 rounded p-3 text-sm"><code>List all ESX events</code></pre>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Tool 5: GenerateResourceBoilerplate -->
|
|
||||||
<div class="mb-8 border-l-4 border-indigo-500 pl-6">
|
|
||||||
<h3 class="text-xl font-semibold text-gray-900 mb-3">5. GenerateResourceBoilerplate</h3>
|
|
||||||
<p class="text-gray-700 mb-4">Generate complete resource boilerplate code.</p>
|
|
||||||
|
|
||||||
<h4 class="font-semibold text-gray-900 mb-2">Parameters:</h4>
|
|
||||||
<ul class="list-disc list-inside text-gray-700 mb-4 ml-4">
|
|
||||||
<li><code class="bg-gray-100 px-2 py-1 rounded text-sm">resource_name</code> (required): Resource name</li>
|
|
||||||
<li><code class="bg-gray-100 px-2 py-1 rounded text-sm">framework</code> (optional): standalone, esx, or qbcore
|
|
||||||
(default: standalone)</li>
|
|
||||||
<li><code class="bg-gray-100 px-2 py-1 rounded text-sm">script_type</code> (optional): lua or js (default: lua)
|
|
||||||
</li>
|
|
||||||
<li><code class="bg-gray-100 px-2 py-1 rounded text-sm">include_nui</code> (optional): Include NUI files
|
|
||||||
(default: false)</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<h4 class="font-semibold text-gray-900 mb-2">Example:</h4>
|
|
||||||
<pre
|
|
||||||
class="bg-gray-100 rounded p-3 text-sm"><code>Generate boilerplate for a QBCore resource with NUI called "admin-panel"</code></pre>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Tool 6: GetQBCoreEventReference -->
|
|
||||||
<div class="mb-8 border-l-4 border-indigo-500 pl-6">
|
|
||||||
<h3 class="text-xl font-semibold text-gray-900 mb-3">6. GetQBCoreEventReference</h3>
|
|
||||||
<p class="text-gray-700 mb-4">Get information about QBCore framework events.</p>
|
|
||||||
|
|
||||||
<h4 class="font-semibold text-gray-900 mb-2">Parameters:</h4>
|
|
||||||
<ul class="list-disc list-inside text-gray-700 mb-4 ml-4">
|
|
||||||
<li><code class="bg-gray-100 px-2 py-1 rounded text-sm">event_name</code> (optional): Specific event name to
|
|
||||||
look up</li>
|
|
||||||
<li><code class="bg-gray-100 px-2 py-1 rounded text-sm">event_category</code> (optional): Filter by category
|
|
||||||
(all, player, job, inventory, vehicle, money)</li>
|
|
||||||
<li><code class="bg-gray-100 px-2 py-1 rounded text-sm">language</code> (optional): Code example language (lua
|
|
||||||
or js)</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<h4 class="font-semibold text-gray-900 mb-2">Examples:</h4>
|
|
||||||
<pre class="bg-gray-100 rounded p-3 text-sm mb-2"><code>What's the QBCore:Client:OnPlayerLoaded event?</code></pre>
|
|
||||||
<pre class="bg-gray-100 rounded p-3 text-sm mb-2"><code>Show me all QBCore player events</code></pre>
|
|
||||||
<pre class="bg-gray-100 rounded p-3 text-sm"><code>List all QBCore inventory events</code></pre>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Tool 7: GetQBCoreFunction -->
|
|
||||||
<div class="mb-8 border-l-4 border-indigo-500 pl-6">
|
|
||||||
<h3 class="text-xl font-semibold text-gray-900 mb-3">7. GetQBCoreFunction</h3>
|
|
||||||
<p class="text-gray-700 mb-4">Look up QBCore functions and exports.</p>
|
|
||||||
|
|
||||||
<h4 class="font-semibold text-gray-900 mb-2">Parameters:</h4>
|
|
||||||
<ul class="list-disc list-inside text-gray-700 mb-4 ml-4">
|
|
||||||
<li><code class="bg-gray-100 px-2 py-1 rounded text-sm">function_name</code> (required): QBCore function name
|
|
||||||
(e.g., "QBCore.Functions.GetPlayer", "AddMoney")</li>
|
|
||||||
<li><code class="bg-gray-100 px-2 py-1 rounded text-sm">language</code> (optional): Code example language (lua
|
|
||||||
or js)</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<h4 class="font-semibold text-gray-900 mb-2">Common QBCore Functions:</h4>
|
|
||||||
<ul class="list-disc list-inside text-gray-700 mb-4 ml-4">
|
|
||||||
<li>Player: <code class="bg-gray-100 px-2 py-1 rounded text-sm">QBCore.Functions.GetPlayer</code>, <code
|
|
||||||
class="bg-gray-100 px-2 py-1 rounded text-sm">QBCore.Functions.GetPlayerData</code></li>
|
|
||||||
<li>Items: <code class="bg-gray-100 px-2 py-1 rounded text-sm">AddItem</code>, <code
|
|
||||||
class="bg-gray-100 px-2 py-1 rounded text-sm">RemoveItem</code>, <code
|
|
||||||
class="bg-gray-100 px-2 py-1 rounded text-sm">GetItemByName</code></li>
|
|
||||||
<li>Money: <code class="bg-gray-100 px-2 py-1 rounded text-sm">AddMoney</code>, <code
|
|
||||||
class="bg-gray-100 px-2 py-1 rounded text-sm">RemoveMoney</code>, <code
|
|
||||||
class="bg-gray-100 px-2 py-1 rounded text-sm">GetMoney</code></li>
|
|
||||||
<li>Jobs: <code class="bg-gray-100 px-2 py-1 rounded text-sm">SetJob</code>, <code
|
|
||||||
class="bg-gray-100 px-2 py-1 rounded text-sm">GetJob</code></li>
|
|
||||||
<li>Vehicles: <code class="bg-gray-100 px-2 py-1 rounded text-sm">AddVehicle</code>, <code
|
|
||||||
class="bg-gray-100 px-2 py-1 rounded text-sm">DeleteVehicle</code></li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<h4 class="font-semibold text-gray-900 mb-2">Example:</h4>
|
|
||||||
<pre class="bg-gray-100 rounded p-3 text-sm"><code>How do I use the AddMoney function in QBCore?</code></pre>
|
|
||||||
</div>
|
|
||||||
<!-- Tool 8: GetCOXEventReference -->
|
|
||||||
<div class="mb-8 border-l-4 border-indigo-500 pl-6">
|
|
||||||
<h3 class="text-xl font-semibold text-gray-900 mb-3">8. GetCOXEventReference</h3>
|
|
||||||
<p class="text-gray-700 mb-4">Get information about COX MySQL events and callbacks.</p>
|
|
||||||
|
|
||||||
<h4 class="font-semibold text-gray-900 mb-2">Parameters:</h4>
|
|
||||||
<ul class="list-disc list-inside text-gray-700 mb-4 ml-4">
|
|
||||||
<li><code class="bg-gray-100 px-2 py-1 rounded text-sm">event_name</code> (optional): Specific event name to
|
|
||||||
look up</li>
|
|
||||||
<li><code class="bg-gray-100 px-2 py-1 rounded text-sm">event_type</code> (optional): Filter by type (all,
|
|
||||||
query, connection, transaction, error)</li>
|
|
||||||
<li><code class="bg-gray-100 px-2 py-1 rounded text-sm">language</code> (optional): Code example language (lua
|
|
||||||
or js)</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<h4 class="font-semibold text-gray-900 mb-2">Examples:</h4>
|
|
||||||
<pre class="bg-gray-100 rounded p-3 text-sm mb-2"><code>What are the COX MySQL connection events?</code></pre>
|
|
||||||
<pre class="bg-gray-100 rounded p-3 text-sm mb-2"><code>Show me all COX transaction events</code></pre>
|
|
||||||
<pre class="bg-gray-100 rounded p-3 text-sm"><code>How do I handle query errors in COX?</code></pre>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Tool 9: GetCOXFunction -->
|
|
||||||
<div class="mb-8 border-l-4 border-indigo-500 pl-6">
|
|
||||||
<h3 class="text-xl font-semibold text-gray-900 mb-3">9. GetCOXFunction</h3>
|
|
||||||
<p class="text-gray-700 mb-4">Look up COX MySQL functions and methods.</p>
|
|
||||||
|
|
||||||
<h4 class="font-semibold text-gray-900 mb-2">Parameters:</h4>
|
|
||||||
<ul class="list-disc list-inside text-gray-700 mb-4 ml-4">
|
|
||||||
<li><code class="bg-gray-100 px-2 py-1 rounded text-sm">function_name</code> (required): COX function name
|
|
||||||
(e.g., "MySQL.query", "MySQL.insert")</li>
|
|
||||||
<li><code class="bg-gray-100 px-2 py-1 rounded text-sm">language</code> (optional): Code example language (lua
|
|
||||||
or js)</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<h4 class="font-semibold text-gray-900 mb-2">Common COX Methods:</h4>
|
|
||||||
<ul class="list-disc list-inside text-gray-700 mb-4 ml-4">
|
|
||||||
<li>Query: <code class="bg-gray-100 px-2 py-1 rounded text-sm">MySQL.query</code>, <code
|
|
||||||
class="bg-gray-100 px-2 py-1 rounded text-sm">MySQL.single</code>, <code
|
|
||||||
class="bg-gray-100 px-2 py-1 rounded text-sm">MySQL.scalar</code></li>
|
|
||||||
<li>Modify: <code class="bg-gray-100 px-2 py-1 rounded text-sm">MySQL.insert</code>, <code
|
|
||||||
class="bg-gray-100 px-2 py-1 rounded text-sm">MySQL.update</code></li>
|
|
||||||
<li>Transactions: <code class="bg-gray-100 px-2 py-1 rounded text-sm">MySQL.transaction.begin</code>, <code
|
|
||||||
class="bg-gray-100 px-2 py-1 rounded text-sm">MySQL.transaction.commit</code></li>
|
|
||||||
<li>Connection: <code class="bg-gray-100 px-2 py-1 rounded text-sm">MySQL.ready</code>, <code
|
|
||||||
class="bg-gray-100 px-2 py-1 rounded text-sm">MySQL.getStatus</code></li>
|
|
||||||
<li>Security: <code class="bg-gray-100 px-2 py-1 rounded text-sm">MySQL.prepare</code> (prepared statements)
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<h4 class="font-semibold text-gray-900 mb-2">Example:</h4>
|
|
||||||
<pre
|
|
||||||
class="bg-gray-100 rounded p-3 text-sm"><code>How do I query the database safely with prepared statements?</code></pre>
|
|
||||||
</div>
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<!-- Available Resources -->
|
<!-- Available Resources -->
|
||||||
<section class="mb-12">
|
<section class="mb-12">
|
||||||
<h2 class="text-2xl font-bold text-gray-900 mb-6">Available Resources</h2>
|
<h2 class="text-2xl font-bold text-gray-900 mb-6">Available Resources</h2>
|
||||||
<p class="text-gray-700 mb-6">MCP Resources provide read-only reference documentation that AI assistants can access:</p>
|
<p class="text-gray-700 mb-6">
|
||||||
|
MCP Resources provide read-only reference documentation that AI assistants can access.
|
||||||
|
Currently available: {{ count($resources) }} resources.
|
||||||
|
</p>
|
||||||
|
|
||||||
<!-- Resource 1: Code Snippets -->
|
@forelse ($resources as $index => $resource)
|
||||||
<div class="mb-8 border-l-4 border-green-500 pl-6">
|
<div class="mb-6 border-l-4 border-green-500 pl-6">
|
||||||
<h3 class="text-xl font-semibold text-gray-900 mb-3">1. Code Snippets</h3>
|
<h3 class="text-lg font-semibold text-gray-900 mb-2">{{ $index + 1 }}. {{ $resource['name'] }}</h3>
|
||||||
<p class="text-gray-700 mb-4">Common FiveM code patterns and snippets for quick reference.</p>
|
<p class="text-gray-700">{{ $resource['description'] }}</p>
|
||||||
<p class="text-gray-600 text-sm">URI: <code class="bg-gray-100 px-2 py-1 rounded text-sm">fivem://snippets/common</code></p>
|
|
||||||
<p class="text-gray-700 mt-2">Includes patterns for distance checks, event handlers, threads with cleanup, database queries, and NUI callbacks in both Lua and JavaScript.</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Resource 2: Best Practices -->
|
|
||||||
<div class="mb-8 border-l-4 border-green-500 pl-6">
|
|
||||||
<h3 class="text-xl font-semibold text-gray-900 mb-3">2. Best Practices</h3>
|
|
||||||
<p class="text-gray-700 mb-4">FiveM development best practices and optimization tips.</p>
|
|
||||||
<p class="text-gray-600 text-sm">URI: <code class="bg-gray-100 px-2 py-1 rounded text-sm">fivem://guides/best-practices</code></p>
|
|
||||||
<p class="text-gray-700 mt-2">Covers performance optimization, security best practices, code organization, resource management, testing, and common pitfalls.</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Resource 4: Database Queries -->
|
|
||||||
<div class="mb-8 border-l-4 border-green-500 pl-6">
|
|
||||||
<h3 class="text-xl font-semibold text-gray-900 mb-3">4. Database Queries</h3>
|
|
||||||
<p class="text-gray-700 mb-4">FiveM database query examples and common patterns for COX MySQL.</p>
|
|
||||||
<p class="text-gray-600 text-sm">URI: <code
|
|
||||||
class="bg-gray-100 px-2 py-1 rounded text-sm">fivem://guides/database-queries</code></p>
|
|
||||||
<p class="text-gray-700 mt-2">Covers CRUD operations, prepared statements, transactions, async queries, error handling,
|
|
||||||
performance tips, and common database patterns (SELECT, INSERT, UPDATE, DELETE).</p>
|
|
||||||
</div>
|
</div>
|
||||||
|
@empty
|
||||||
|
<p class="text-gray-500 italic">No resources configured.</p>
|
||||||
|
@endforelse
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<!-- Available Prompts -->
|
<!-- Available Prompts -->
|
||||||
<section class="mb-12">
|
<section class="mb-12">
|
||||||
<h2 class="text-2xl font-bold text-gray-900 mb-6">Available Prompts</h2>
|
<h2 class="text-2xl font-bold text-gray-900 mb-6">Available Prompts</h2>
|
||||||
<p class="text-gray-700 mb-6">MCP Prompts are pre-built prompt templates for common tasks:</p>
|
<p class="text-gray-700 mb-6">
|
||||||
|
MCP Prompts are pre-built prompt templates for common tasks.
|
||||||
|
Currently available: {{ count($prompts) }} prompts.
|
||||||
|
</p>
|
||||||
|
|
||||||
<!-- Prompt 1: Create New Resource -->
|
@forelse ($prompts as $index => $prompt)
|
||||||
<div class="mb-8 border-l-4 border-purple-500 pl-6">
|
<div class="mb-6 border-l-4 border-purple-500 pl-6">
|
||||||
<h3 class="text-xl font-semibold text-gray-900 mb-3">1. Create New Resource</h3>
|
<h3 class="text-lg font-semibold text-gray-900 mb-2">{{ $index + 1 }}. {{ $prompt['name'] }}</h3>
|
||||||
<p class="text-gray-700 mb-4">Create a new FiveM resource with framework and language selection.</p>
|
<p class="text-gray-700">{{ $prompt['description'] }}</p>
|
||||||
<p class="text-gray-600 text-sm">Parameters: resource_name, framework (standalone/esx/qbcore), language (lua/js)</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Prompt 2: Debug Issues -->
|
|
||||||
<div class="mb-8 border-l-4 border-purple-500 pl-6">
|
|
||||||
<h3 class="text-xl font-semibold text-gray-900 mb-3">2. Debug Issues</h3>
|
|
||||||
<p class="text-gray-700 mb-4">Debug common FiveM issues and errors with detailed analysis.</p>
|
|
||||||
<p class="text-gray-600 text-sm">Parameters: issue (description), error_message (from console)</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Prompt 3: Optimize Performance -->
|
|
||||||
<div class="mb-8 border-l-4 border-purple-500 pl-6">
|
|
||||||
<h3 class="text-xl font-semibold text-gray-900 mb-3">3. Optimize Performance</h3>
|
|
||||||
<p class="text-gray-700 mb-4">Optimize FiveM script performance with detailed suggestions.</p>
|
|
||||||
<p class="text-gray-600 text-sm">Parameters: code (script to optimize), script_type (client/server/shared)</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Prompt 4: Convert Language -->
|
|
||||||
<div class="mb-8 border-l-4 border-purple-500 pl-6">
|
|
||||||
<h3 class="text-xl font-semibold text-gray-900 mb-3">4. Convert Language</h3>
|
|
||||||
<p class="text-gray-700 mb-4">Convert code between Lua and JavaScript with proper syntax.</p>
|
|
||||||
<p class="text-gray-600 text-sm">Parameters: code, from (lua/js), to (lua/js)</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Prompt 5: Add Framework Integration -->
|
|
||||||
<div class="mb-8 border-l-4 border-purple-500 pl-6">
|
|
||||||
<h3 class="text-xl font-semibold text-gray-900 mb-3">5. Add Framework Integration</h3>
|
|
||||||
<p class="text-gray-700 mb-4">Add ESX or QBCore framework integration to existing resource.</p>
|
|
||||||
<p class="text-gray-600 text-sm">Parameters: code (current resource), current_framework, target_framework (esx/qbcore)</p>
|
|
||||||
</div>
|
</div>
|
||||||
|
@empty
|
||||||
|
<p class="text-gray-500 italic">No prompts configured.</p>
|
||||||
|
@endforelse
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<!-- Testing -->
|
<!-- Testing -->
|
||||||
|
|||||||
@@ -42,6 +42,20 @@ it('documentation renders correct view', function () {
|
|||||||
$response->assertViewIs('docs.documentation');
|
$response->assertViewIs('docs.documentation');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('documentation page includes dynamic tools data', function () {
|
||||||
|
$response = $this->get('/documentation');
|
||||||
|
|
||||||
|
$response->assertViewHas('tools');
|
||||||
|
$response->assertViewHas('resources');
|
||||||
|
$response->assertViewHas('prompts');
|
||||||
|
|
||||||
|
expect($response->viewData('tools'))->toBeArray();
|
||||||
|
expect($response->viewData('resources'))->toBeArray();
|
||||||
|
expect($response->viewData('prompts'))->toBeArray();
|
||||||
|
|
||||||
|
expect($response->viewData('tools'))->not()->toBeEmpty();
|
||||||
|
});
|
||||||
|
|
||||||
it('nonexistent route returns 404', function () {
|
it('nonexistent route returns 404', function () {
|
||||||
$response = $this->get('/nonexistent-page-xyz');
|
$response = $this->get('/nonexistent-page-xyz');
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user