lookup_dimensionitems
Resolve dimension item names or codes to their IDs for use in data writes.
Instructions
Look up dimension items by name or code to get their IDs. Useful for resolving human-readable names to itemIds before write_cells.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| workspaceId | Yes | Anaplan workspace ID or name | |
| modelId | Yes | Anaplan model ID or name | |
| dimensionId | Yes | Dimension ID (from show_lineitem_dimensions or show_viewdetails) | |
| names | No | Item names to look up | |
| codes | No | Item codes to look up |
Implementation Reference
- src/tools/exploration.ts:528-543 (handler)Handler function for the lookup_dimensionitems tool. Resolves workspace/model by name/ID, calls the API to look up dimension items by name or code, and returns results in table format.
server.tool("lookup_dimensionitems", "Look up dimension items by name or code to get their IDs. Useful for resolving human-readable names to itemIds before write_cells.", { workspaceId: z.string().describe("Anaplan workspace ID or name"), modelId: z.string().describe("Anaplan model ID or name"), dimensionId: z.string().describe("Dimension ID (from show_lineitem_dimensions or show_viewdetails)"), names: z.array(z.string()).optional().describe("Item names to look up"), codes: z.array(z.string()).optional().describe("Item codes to look up"), }, async ({ workspaceId, modelId, dimensionId, names, codes }) => { const wId = await resolver.resolveWorkspace(workspaceId); const mId = await resolver.resolveModel(wId, modelId); const items = await apis.dimensions.lookupByNameOrCode(wId, mId, dimensionId, names, codes); return tableResult(items, [ { header: "Name", key: "name" }, { header: "Code", key: "code" }, { header: "ID", key: "id" }, ], "matched items"); }); - src/tools/exploration.ts:529-534 (schema)Input schema for lookup_dimensionitems using Zod validation: workspaceId, modelId, dimensionId (required strings) and optional arrays of names and codes.
workspaceId: z.string().describe("Anaplan workspace ID or name"), modelId: z.string().describe("Anaplan model ID or name"), dimensionId: z.string().describe("Dimension ID (from show_lineitem_dimensions or show_viewdetails)"), names: z.array(z.string()).optional().describe("Item names to look up"), codes: z.array(z.string()).optional().describe("Item codes to look up"), }, async ({ workspaceId, modelId, dimensionId, names, codes }) => { - src/api/dimensions.ts:20-32 (helper)API helper method that performs the actual HTTP POST to Anaplan API to look up dimension items by name or code, returning matched items.
async lookupByNameOrCode( workspaceId: string, modelId: string, dimensionId: string, names?: string[], codes?: string[], ) { const res = await this.client.post<any>( `/workspaces/${workspaceId}/models/${modelId}/dimensions/${dimensionId}/items`, { names, codes } ); return res.items ?? []; } - src/server.ts:54-57 (registration)Registration call: lookup_dimensionitems is registered via registerExplorationTools in server.ts, which calls server.tool() inside exploration.ts.
registerExplorationTools(server, { workspaces, models, modules, lists, imports, exports, processes, files, actions, transactional, modelManagement, dimensions, calendar, versions, users, }, resolver); - src/tools/exploration.ts:77-77 (registration)Export function that registers all exploration tools including lookup_dimensionitems on the MCP server instance.
export function registerExplorationTools(server: McpServer, apis: ExplorationApis, resolver: NameResolver) {