Skip to main content
Glama
LegacyToolWrapper.php1.34 kB
<?php namespace App\Services; use App\Contracts\MCPToolInterface; use OPGG\LaravelMcpServer\Services\ToolService\ToolInterface; class LegacyToolWrapper implements MCPToolInterface { private ToolInterface $modernTool; public function __construct(ToolInterface $modernTool) { $this->modernTool = $modernTool; } public function getName(): string { return $this->modernTool->name(); } public function getDescription(): string { return $this->modernTool->description(); } public function getInputSchema(): array { return $this->modernTool->inputSchema(); } public function execute(array $parameters): array { try { $result = $this->modernTool->execute($parameters); // Convert modern tool result to legacy format if (is_array($result) && isset($result['content'])) { // Already in MCP format return $result; } // Convert simple result to MCP format return [ 'success' => true, 'data' => $result ]; } catch (\Exception $e) { return [ 'success' => false, 'error' => $e->getMessage() ]; } } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/uberr2000/mcp_demo'

If you have feedback or need assistance with the MCP directory API, please join our Discord server