feat: Update COX and QBCore tools with new event and function references, enhance documentation views, and improve boilerplate generation

This commit is contained in:
Adrian Mejias committed 2026-03-01 14:41:31 -06:00
1 parent 6a14dff647
commit 2f8ebe2940
31 files changed
+87 -122

No files matched your search

+9 -9
View File
@@ -29,15 +29,15 @@ class AddFrameworkIntegration extends Prompt
$parts[] = sprintf(
"%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n\n%s",
"Please:",
"1. Update the fxmanifest.lua with framework dependencies",
"2. Replace custom player systems with framework functions",
"3. Convert money/inventory operations to framework equivalents",
"4. Update event handlers to use framework events",
"5. Add framework-specific features if beneficial",
"6. Maintain backward compatibility where possible",
"7. Add comments explaining the integration changes",
"Use the GetEventReference tool to find relevant framework events."
'Please:',
'1. Update the fxmanifest.lua with framework dependencies',
'2. Replace custom player systems with framework functions',
'3. Convert money/inventory operations to framework equivalents',
'4. Update event handlers to use framework events',
'5. Add framework-specific features if beneficial',
'6. Maintain backward compatibility where possible',
'7. Add comments explaining the integration changes',
'Use the GetEventReference tool to find relevant framework events.'
);
return Response::prompt(implode('', $parts));
+13 -13
View File
@@ -25,19 +25,19 @@ class ConvertLanguage extends Prompt
$parts[] = sprintf(
"%s\n%s\n%s\n%s\n%s\n%s\n%s\n\n%s\n%s\n%s\n%s\n%s\n%s",
"Please:",
"1. Convert the code while maintaining functionality",
"2. Use idiomatic patterns for the target language",
"3. Update native function calls to match language syntax",
"4. Adjust event handlers and callbacks",
"5. Explain major differences in the conversion",
"6. Ensure FiveM compatibility in the target language",
"Key differences to consider:",
"- Array/table indexing (0 vs 1-based)",
"- String formatting",
"- Event registration syntax",
"- Async patterns",
"- Native return values"
'Please:',
'1. Convert the code while maintaining functionality',
'2. Use idiomatic patterns for the target language',
'3. Update native function calls to match language syntax',
'4. Adjust event handlers and callbacks',
'5. Explain major differences in the conversion',
'6. Ensure FiveM compatibility in the target language',
'Key differences to consider:',
'- Array/table indexing (0 vs 1-based)',
'- String formatting',
'- Event registration syntax',
'- Async patterns',
'- Native return values'
);
return Response::prompt(implode('', $parts));
+11 -11
View File
@@ -18,17 +18,17 @@ class CreateNewResource extends Prompt
$language = $request->get('language', 'lua');
return Response::prompt(sprintf(
"Create a new FiveM resource called '%s' with the following requirements:\n\n" .
"Framework: %s\n" .
"Language: %s\n\n" .
"Please:\n" .
"1. Generate a complete fxmanifest.lua\n" .
"2. Create a config file with common settings\n" .
"3. Generate boilerplate client and server files\n" .
"4. Include proper error handling and validation\n" .
"5. Follow FiveM best practices\n" .
"6. Add helpful comments explaining the code structure\n\n" .
"Use the available tools to generate the manifest and boilerplate code.",
"Create a new FiveM resource called '%s' with the following requirements:\n\n".
"Framework: %s\n".
"Language: %s\n\n".
"Please:\n".
"1. Generate a complete fxmanifest.lua\n".
"2. Create a config file with common settings\n".
"3. Generate boilerplate client and server files\n".
"4. Include proper error handling and validation\n".
"5. Follow FiveM best practices\n".
"6. Add helpful comments explaining the code structure\n\n".
'Use the available tools to generate the manifest and boilerplate code.',
$resourceName,
$framework,
$language
+7 -7
View File
@@ -28,13 +28,13 @@ class DebugIssues extends Prompt
$parts[] = sprintf(
"%s\n%s\n%s\n%s\n%s\n%s\n\n%s",
"Please analyze this issue and:",
"1. Identify the likely cause",
"2. Suggest fixes with code examples",
"3. Explain common mistakes that lead to this issue",
"4. Provide preventive measures",
"5. Reference FiveM best practices if applicable",
"Use the SearchFiveMDocs and GetNativeFunction tools to find relevant information."
'Please analyze this issue and:',
'1. Identify the likely cause',
'2. Suggest fixes with code examples',
'3. Explain common mistakes that lead to this issue',
'4. Provide preventive measures',
'5. Reference FiveM best practices if applicable',
'Use the SearchFiveMDocs and GetNativeFunction tools to find relevant information.'
);
return Response::prompt(implode('', $parts));
+12 -12
View File
@@ -25,18 +25,18 @@ class OptimizePerformance extends Prompt
$parts[] = sprintf(
"Script Type: %s\n\n%s\n%s\n%s\n%s\n%s\n%s\n\n%s\n%s\n%s\n%s\n%s\n%s",
$scriptType,
"Please analyze the code and:",
"1. Identify performance issues (unnecessary loops, missing waits, etc.)",
"2. Suggest optimizations with code examples",
"3. Explain why each optimization improves performance",
"4. Provide the optimized version of the code",
"5. Reference FiveM best practices for performance",
"Focus on:",
"- Proper Citizen.Wait() usage",
"- Distance checks before expensive operations",
"- Caching frequently accessed values",
"- Reducing server-client communication",
"- Efficient event handling"
'Please analyze the code and:',
'1. Identify performance issues (unnecessary loops, missing waits, etc.)',
'2. Suggest optimizations with code examples',
'3. Explain why each optimization improves performance',
'4. Provide the optimized version of the code',
'5. Reference FiveM best practices for performance',
'Focus on:',
'- Proper Citizen.Wait() usage',
'- Distance checks before expensive operations',
'- Caching frequently accessed values',
'- Reducing server-client communication',
'- Efficient event handling'
);
return Response::prompt(implode('', $parts));
@@ -150,7 +150,7 @@ class GetInventoryClientFunction extends Tool
*/
protected function formatFunctionInfo(array $function, string $language): string
{
return view('mcp.cox-function', [
return view('mcp.cox.cox-function', [
'function' => $function,
'language' => $language,
])->render();
@@ -309,7 +309,7 @@ class GetInventoryServerFunction extends Tool
*/
protected function formatFunctionInfo(array $function, string $language): string
{
return view('mcp.cox-function', [
return view('mcp.cox.cox-function', [
'function' => $function,
'language' => $language,
])->render();
@@ -60,7 +60,7 @@ class GetCOXEventReference extends Tool
}
return Response::text(
view('mcp.cox-event-list', [
view('mcp.cox.cox-event-list', [
'eventsByType' => $eventsByType,
])->render()
);
@@ -71,7 +71,7 @@ class GetCOXEventReference extends Tool
*/
protected function formatEventInfo(array $event, string $language): string
{
return view('mcp.cox-event-reference', [
return view('mcp.cox.cox-event-reference', [
'event' => $event,
'language' => $language,
])->render();
+1 -1
View File
@@ -163,7 +163,7 @@ class GetCOXFunction extends Tool
*/
protected function formatFunctionInfo(array $function, string $language): string
{
return view('mcp.cox-function', [
return view('mcp.cox.cox-function', [
'function' => $function,
'language' => $language,
])->render();
@@ -60,7 +60,7 @@ class GetEventClientReference extends Tool
}
return Response::text(
view('mcp.event-list', [
view('mcp.fivem.event-list', [
'eventsByType' => $eventsByType,
])->render()
);
@@ -71,7 +71,7 @@ class GetEventClientReference extends Tool
*/
protected function formatEventInfo(array $event, string $language): string
{
return view('mcp.event-reference', [
return view('mcp.fivem.event-reference', [
'event' => $event,
'language' => $language,
])->render();
@@ -193,7 +193,7 @@ class GetNativeClientFunction extends Tool
*/
protected function formatNativeInfo(array $native, string $language): string
{
return view('mcp.native-function', [
return view('mcp.fivem.native-function', [
'native' => $native,
'language' => $language,
])->render();
@@ -29,7 +29,7 @@ class GenerateResourceBoilerplate extends Tool
]);
return Response::text(
view('mcp.resource-boilerplate', [
view('mcp.shared.resource-boilerplate', [
'resourceName' => $resourceName,
'files' => $files,
])->render()
+1 -1
View File
@@ -26,7 +26,7 @@ class SearchFiveMDocs extends Tool
}
return Response::text(
view('mcp.search-results', [
view('mcp.shared.search-results', [
'query' => $query,
'results' => $results,
])->render()
@@ -60,7 +60,7 @@ class GetEventServerReference extends Tool
}
return Response::text(
view('mcp.event-list', [
view('mcp.fivem.event-list', [
'eventsByType' => $eventsByType,
])->render()
);
@@ -71,7 +71,7 @@ class GetEventServerReference extends Tool
*/
protected function formatEventInfo(array $event, string $language): string
{
return view('mcp.event-reference', [
return view('mcp.fivem.event-reference', [
'event' => $event,
'language' => $language,
])->render();
@@ -182,7 +182,7 @@ class GetNativeServerFunction extends Tool
*/
protected function formatNativeInfo(array $native, string $language): string
{
return view('mcp.native-function', [
return view('mcp.fivem.native-function', [
'native' => $native,
'language' => $language,
])->render();
@@ -94,26 +94,9 @@ class GetQBCoreClientEventReference extends Tool
*/
protected function formatEvent(array $event): string
{
return <<<EOT
**Event: {$event['name']}**
**Side:** Client
**Description:** {$event['description']}
**Parameters:**
{$this->formatParameters($event['parameters'])}
**Lua Example:**
\`\`\`lua
{$event['lua_example']}
\`\`\`
**JavaScript Example:**
\`\`\`javascript
{$event['js_example']}
\`\`\`
EOT;
return view('mcp.qbcore.qbcore-event-reference', [
'event' => $event,
])->render();
}
/**
@@ -121,10 +104,10 @@ EOT;
*/
protected function formatEventList(array $events, string $title): string
{
$list = "# {$title}\n\n";
$list = sprintf("# %s\n\n", $title);
foreach ($events as $event) {
$list .= "- **{$event['name']}**: {$event['description']}\n";
$list .= sprintf("- **%s**: %s\n", $event['name'], $event['description']);
}
return $list;
@@ -137,7 +120,7 @@ EOT;
{
$formatted = '';
foreach ($parameters as $name => $description) {
$formatted .= "- `{$name}`: {$description}\n";
$formatted .= sprintf("- `%s`: %s\n", $name, $description);
}
return $formatted;
@@ -131,7 +131,7 @@ class GetQBCoreClientFunction extends Tool
*/
protected function formatFunctionInfo(array $function, string $language): string
{
return view('mcp.qbcore-function', [
return view('mcp.qbcore.qbcore-function', [
'function' => $function,
'language' => $language,
])->render();
@@ -94,26 +94,9 @@ class GetQBCoreServerEventReference extends Tool
*/
protected function formatEvent(array $event): string
{
return <<<EOT
**Event: {$event['name']}**
**Side:** Server
**Description:** {$event['description']}
**Parameters:**
{$this->formatParameters($event['parameters'])}
**Lua Example:**
\`\`\`lua
{$event['lua_example']}
\`\`\`
**JavaScript Example:**
\`\`\`javascript
{$event['js_example']}
\`\`\`
EOT;
return view('mcp.qbcore.qbcore-event-reference', [
'event' => $event,
])->render();
}
/**
@@ -121,10 +104,10 @@ EOT;
*/
protected function formatEventList(array $events, string $title): string
{
$list = "# {$title}\n\n";
$list = sprintf("# %s\n\n", $title);
foreach ($events as $event) {
$list .= "- **{$event['name']}**: {$event['description']}\n";
$list .= sprintf("- **%s**: %s\n", $event['name'], $event['description']);
}
return $list;
@@ -137,7 +120,7 @@ EOT;
{
$formatted = '';
foreach ($parameters as $name => $description) {
$formatted .= "- `{$name}`: {$description}\n";
$formatted .= sprintf("- `%s`: %s\n", $name, $description);
}
return $formatted;
@@ -196,7 +196,7 @@ class GetQBCoreServerFunction extends Tool
*/
protected function formatFunctionInfo(array $function, string $language): string
{
return view('mcp.qbcore-function', [
return view('mcp.qbcore.qbcore-function', [
'function' => $function,
'language' => $language,
])->render();
@@ -2,7 +2,6 @@
## {{ $event['name'] }}
**Category:** {{ $event['category'] }}
**Side:** {{ ucfirst($event['side']) }}
### Description
@@ -10,8 +9,8 @@
### Parameters
@if(count($event['parameters']) > 0)
@foreach($event['parameters'] as $param)
- **{{ $param['name'] }}** ({{ $param['type'] }}): {{ $param['description'] }}
@foreach($event['parameters'] as $name => $description)
- `{{ $name }}`: {{ $description }}
@endforeach
@else
This event takes no parameters.
+6 -6
View File
@@ -4,7 +4,7 @@ use App\Mcp\Resources\CodeSnippets;
use Laravel\Mcp\Request;
it('code snippets resource returns response with content', function () {
$resource = new CodeSnippets();
$resource = new CodeSnippets;
$request = new Request([]);
$response = $resource->handle($request);
@@ -14,7 +14,7 @@ it('code snippets resource returns response with content', function () {
});
it('code snippets response contains content', function () {
$resource = new CodeSnippets();
$resource = new CodeSnippets;
$request = new Request([]);
$response = $resource->handle($request);
@@ -24,7 +24,7 @@ it('code snippets response contains content', function () {
});
it('best practices resource returns response with content', function () {
$resource = new \App\Mcp\Resources\BestPractices();
$resource = new \App\Mcp\Resources\BestPractices;
$request = new Request([]);
$response = $resource->handle($request);
@@ -34,7 +34,7 @@ it('best practices resource returns response with content', function () {
});
it('best practices response contains content', function () {
$resource = new \App\Mcp\Resources\BestPractices();
$resource = new \App\Mcp\Resources\BestPractices;
$request = new Request([]);
$response = $resource->handle($request);
@@ -44,7 +44,7 @@ it('best practices response contains content', function () {
});
it('framework comparison resource returns response with content', function () {
$resource = new \App\Mcp\Resources\FrameworkComparison();
$resource = new \App\Mcp\Resources\FrameworkComparison;
$request = new Request([]);
$response = $resource->handle($request);
@@ -54,7 +54,7 @@ it('framework comparison resource returns response with content', function () {
});
it('framework comparison response contains content', function () {
$resource = new \App\Mcp\Resources\FrameworkComparison();
$resource = new \App\Mcp\Resources\FrameworkComparison;
$request = new Request([]);
$response = $resource->handle($request);