give_item
Distribute items to Minecraft players using player selectors and item IDs. Specify target players and item types to manage in-game resources.
Instructions
Give items to a player. Examples: 'diamond', 'diamond_sword', 'golden_apple'.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| target | Yes | Player selector (e.g., '@a', '@p', 'PlayerName') | |
| item | Yes | Item ID (e.g., 'diamond', 'netherite_sword') | |
| count | No | Number of items |
Implementation Reference
- src/tools/command-tools.ts:313-324 (handler)The handler function for the 'give_item' tool, which executes an RCON 'give' command.
async ({ target, item, count }) => { try { const response = await manager.rcon.send( `give ${target} ${item} ${count}` ); return { content: [{ type: "text", text: response }] }; } catch (error) { return { content: [ { type: "text", text: `Failed: ${error instanceof Error ? error.message : String(error)}`, - src/tools/command-tools.ts:305-312 (registration)Registration of the 'give_item' tool with its schema definition.
server.tool( "give_item", "Give items to a player. Examples: 'diamond', 'diamond_sword', 'golden_apple'.", { target: z.string().describe("Player selector (e.g., '@a', '@p', 'PlayerName')"), item: z.string().describe("Item ID (e.g., 'diamond', 'netherite_sword')"), count: z.number().optional().default(1).describe("Number of items"), },