Skip to main content
Glama
inventory.ts1.82 kB
import { z } from 'zod'; // Constants for inventory system limits export const INVENTORY_LIMITS = { MAX_ITEM_VALUE: 10_000_000, // 10 million gold max per item MAX_STACK_SIZE: 9999, // Max items in a single stack MAX_GIVE_QUANTITY: 9999, // Max items that can be given at once DEFAULT_WEIGHT_CAPACITY: 100 // Default carry weight (based on STR in future) } as const; export const ItemSchema = z.object({ id: z.string(), name: z.string() .min(1, 'Item name cannot be empty') .refine(s => s.trim().length > 0, 'Item name cannot be whitespace only'), description: z.string().optional(), type: z.enum(['weapon', 'armor', 'consumable', 'quest', 'misc', 'scroll']), weight: z.number().min(0).default(0), value: z.number().min(0).max(INVENTORY_LIMITS.MAX_ITEM_VALUE, `Item value cannot exceed ${INVENTORY_LIMITS.MAX_ITEM_VALUE.toLocaleString()} gold`).default(0), properties: z.record(z.any()).optional(), createdAt: z.string().datetime(), updatedAt: z.string().datetime() }); export const InventoryItemSchema = z.object({ itemId: z.string(), quantity: z.number().int().min(1), equipped: z.boolean().default(false), slot: z.string().optional() // 'mainhand', 'offhand', 'armor', etc. }); export const InventorySchema = z.object({ characterId: z.string(), items: z.array(InventoryItemSchema), capacity: z.number().default(100), // Weight limit currency: z.object({ gold: z.number().int().min(0).default(0), silver: z.number().int().min(0).default(0), copper: z.number().int().min(0).default(0) }).default({}) }); export type Item = z.infer<typeof ItemSchema>; export type InventoryItem = z.infer<typeof InventoryItemSchema>; export type Inventory = z.infer<typeof InventorySchema>;

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/Mnehmos/rpg-mcp'

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