Skip to content

Commit aa53f96

Browse files
committed
fix: fixing the mcp token
1 parent a187d0a commit aa53f96

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

src/MCP/Collections/ToolsCollection.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public function toUi(): self
1616
'title' => $tool['title'],
1717
'description' => $tool['description'],
1818
'category' => $tool['category'],
19-
'type' => $tool['type'],
19+
'type' => $tool['type'] instanceof OperationTypeEnum ? $tool['type']->name : $tool['type'],
2020
]);
2121
}
2222

@@ -33,4 +33,18 @@ public function pushTool(Tool $tool, string $repositoryKey, array $extra = []):
3333
'category' => ToolsCategoryEnum::fromTool($tool)->value,
3434
], $extra));
3535
}
36+
37+
public function toSelectOptions(): array
38+
{
39+
return $this->groupBy('category')
40+
->map(fn ($tools, $category) => [
41+
'category' => $category,
42+
'tools' => $tools->map(fn ($tool) => [
43+
'name' => $tool['name'],
44+
'description' => $tool['description'],
45+
])->values(),
46+
])
47+
->values()
48+
->toArray();
49+
}
3650
}

src/MCP/RestifyServer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,15 +292,15 @@ public function canUseTool(string|object $tool): bool
292292
* all individual operations are still discovered and available for permission checks.
293293
* This allows you to create tokens with fine-grained permissions for specific operations.
294294
*/
295-
public function getAllAvailableTools(): Collection
295+
public function getAllAvailableTools(): ToolsCollection
296296
{
297297
return McpTools::all()->toUi();
298298
}
299299

300300
/**
301301
* Get tools that the current user/token is authorized to use.
302302
*/
303-
public function getAuthorizedTools(): Collection
303+
public function getAuthorizedTools(): ToolsCollection
304304
{
305305
return McpTools::authorized()->toUi();
306306
}

0 commit comments

Comments
 (0)