list_ops
Display all server operators from the ops.json file to manage administrator permissions in Minecraft Java Edition servers.
Instructions
List all server operators from ops.json.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/player-tools.ts:276-297 (handler)The handler for the "list_ops" tool, which reads and parses ops.json to return a formatted list of server operators.
server.tool( "list_ops", "List all server operators from ops.json.", {}, async () => { const opsPath = path.join(manager.getServerDir(), "ops.json"); if (!fs.existsSync(opsPath)) { return { content: [{ type: "text", text: "ops.json not found." }], }; } const ops = JSON.parse(fs.readFileSync(opsPath, "utf-8")); if (!Array.isArray(ops) || ops.length === 0) { return { content: [{ type: "text", text: "No operators configured." }] }; } const lines = ops.map( (op: { name: string; uuid: string; level: number }) => `${op.name} (UUID: ${op.uuid}, Level: ${op.level})` ); return { content: [{ type: "text", text: lines.join("\n") }] }; } );