role_list
List all available roles in Crafty Controller to manage user permissions and access control.
Instructions
List all roles in Crafty Controller
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "role_list"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/roles.ts:10-18 (handler)The handler function for the role_list tool, which fetches all roles from the Crafty Client.
async () => { try { const data = await client.get("/roles"); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] }; } catch (error) { const msg = error instanceof Error ? error.message : String(error); return { content: [{ type: "text", text: `Error: ${msg}` }], isError: true }; } } - src/tools/roles.ts:6-19 (registration)Registration of the role_list tool within the MCP server.
server.tool( "role_list", "List all roles in Crafty Controller", {}, async () => { try { const data = await client.get("/roles"); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] }; } catch (error) { const msg = error instanceof Error ? error.message : String(error); return { content: [{ type: "text", text: `Error: ${msg}` }], isError: true }; } } );