Skip to main content
Glama

manage_location

Create, update, and organize locations with connections for party navigation in role-playing games. Supports lighting, hazards, tags, and connection types like doors, stairs, and portals.

Instructions

Manage location graph for party navigation. Operations: create (new location), get (retrieve location + connections), update (modify properties), delete (remove location), link (connect two locations), unlink (disconnect locations), list (all locations). Supports location types, lighting, hazards, tags, and connection types (door, passage, stairs, ladder, portal, hidden).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
operationNo
nameNo
descriptionNo
locationTypeNo
lightingNo
hazardsNo
tagsNo
terrainNo
sizeNo
discoveredNo
propertiesNo
locationIdNo
fromLocationIdNo
toLocationIdNo
connectionTypeNopassage
lockedNo
lockDCNo
hiddenNo
findDCNo
oneWayNo
filterTagNo
filterTypeNo

Implementation Reference

  • Registration of the 'manage_location' tool in the central registry. Imports manageLocation and manageLocationSchema from './modules/data.ts', defines inputSchema using toJsonSchema, and provides a wrapper handler that calls the actual manageLocation function with error handling.
    manage_location: { name: 'manage_location', description: 'Manage location graph for party navigation. Operations: create (new location), get (retrieve location + connections), update (modify properties), delete (remove location), link (connect two locations), unlink (disconnect locations), list (all locations). Supports location types, lighting, hazards, tags, and connection types (door, passage, stairs, ladder, portal, hidden).', inputSchema: toJsonSchema(manageLocationSchema), handler: async (args) => { try { const result = await manageLocation(args); return result; } catch (err) { if (err instanceof z.ZodError) { const messages = err.errors.map(e => `${e.path.join('.')}: ${e.message}`).join(', '); return error(`Validation failed: ${messages}`); } const message = err instanceof Error ? err.message : String(err); return error(message); } }, },
  • Zod schema for 'manage_location' tool input validation. Discriminated union based on 'operation' field supporting create, get, update, delete, link, unlink, list operations with specific fields for each.
    export const manageLocationSchema = z.discriminatedUnion('operation', [ createOperationSchema, getOperationSchema, updateOperationSchema, deleteOperationSchema, linkOperationSchema, unlinkOperationSchema, listOperationSchema, ]);
  • Main handler function for 'manage_location' tool. Parses input using manageLocationSchema, dispatches to specific operation handlers (handleCreate, handleGet, etc.), formats output as ASCII box using createBox, and returns MCP CallToolResult format.
    export async function manageLocation(input: unknown): Promise<{ content: { type: 'text'; text: string }[] }> { try { const parsed = manageLocationSchema.parse(input); let result: string; switch (parsed.operation) { case 'create': result = handleCreate(parsed); break; case 'get': result = handleGet(parsed); break; case 'update': result = handleUpdate(parsed); break; case 'delete': result = handleDelete(parsed); break; case 'link': result = handleLink(parsed); break; case 'unlink': result = handleUnlink(parsed); break; case 'list': result = handleList(parsed); break; default: result = createBox('ERROR', ['Unknown operation'], DISPLAY_WIDTH); } return { content: [{ type: 'text' as const, text: result }] }; } catch (error) { const lines: string[] = []; if (error instanceof z.ZodError) { for (const issue of error.issues) { lines.push(`${issue.path.join('.')}: ${issue.message}`); } } else if (error instanceof Error) { lines.push(error.message); } else { lines.push('An unknown error occurred'); } return { content: [{ type: 'text' as const, text: createBox('ERROR', lines, DISPLAY_WIDTH) }] }; } }
  • In-memory state stores for locations (nodes) and edges (connections) in the location graph, used by all manage_location operations.
    const locationStore = new Map<string, Location>(); /** In-memory edge storage */ const edgeStore = new Map<string, StoredLocationEdge>();

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/ChatRPG'

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