show_imports
List all import actions configured in an Anaplan model to review and prepare for execution.
Instructions
List available import actions in a model. Use show_importdetails to see source file and mapping, then run_import to execute.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| workspaceId | Yes | Anaplan workspace ID or name | |
| modelId | Yes | Anaplan model ID or name | |
| limit | No | Max items to return (default 50, max 1000) | |
| search | No | Filter by name or ID (case-insensitive substring match) |
Implementation Reference
- src/tools/exploration.ts:263-272 (handler)The handler function for the 'show_imports' tool. Accepts workspaceId, modelId, and optional pagination params (limit, search). Resolves workspace and model IDs, calls apis.imports.list(), and returns a formatted table with Name, Type, and ID columns.
server.tool("show_imports", "List available import actions in a model. Use show_importdetails to see source file and mapping, then run_import to execute.", { workspaceId: z.string().describe("Anaplan workspace ID or name"), modelId: z.string().describe("Anaplan model ID or name"), ...paginationParams, }, async ({ workspaceId, modelId, limit, search }) => { const wId = await resolver.resolveWorkspace(workspaceId); const mId = await resolver.resolveModel(wId, modelId); const imports = await apis.imports.list(wId, mId); return tableResult(imports, [{ header: "Name", key: "name" }, { header: "Type", key: "importType" }, { header: "ID", key: "id" }], "imports", { limit, search }); }); - src/tools/exploration.ts:263-266 (schema)Input schema for show_imports: workspaceId (string), modelId (string), plus pagination params (limit number, search string).
server.tool("show_imports", "List available import actions in a model. Use show_importdetails to see source file and mapping, then run_import to execute.", { workspaceId: z.string().describe("Anaplan workspace ID or name"), modelId: z.string().describe("Anaplan model ID or name"), ...paginationParams, - src/tools/exploration.ts:77-77 (registration)The show_imports tool is registered via server.tool() call inside registerExplorationTools() at line 263 of src/tools/exploration.ts.
export function registerExplorationTools(server: McpServer, apis: ExplorationApis, resolver: NameResolver) { - src/api/imports.ts:9-13 (helper)The ImportsApi.list() helper method called by the show_imports handler. Makes a GET request to /workspaces/{workspaceId}/models/{modelId}/imports.
async list(workspaceId: string, modelId: string) { return this.client.getAll<any>( `/workspaces/${workspaceId}/models/${modelId}/imports`, "imports" ); } - src/tools/format.ts:19-50 (helper)The formatTable() helper function used to format the results into a table with filtering by search and limiting by count.
export function formatTable(items: any[], columns: Column[], label: string, options?: FormatOptions): FormatResult { if (items.length === 0) return { table: "", footer: `No ${label} found.` }; const search = options?.search?.toLowerCase(); const limit = Math.min(Math.max(1, options?.limit ?? DEFAULT_LIMIT), MAX_LIMIT); const searchableKeys = Array.from(new Set(["name", "id", ...columns.map((c) => c.key)])); // Filter by search (case-insensitive substring on key fields used in table output) const filtered = search ? items.filter((item) => { return searchableKeys.some((key) => String(item[key] ?? "").toLowerCase().includes(search) ); }) : items; if (filtered.length === 0) { return { table: "", footer: `No ${label} matching "${options!.search}". Try a different search term.` }; } if (filtered.length === 1 && !search) { const item = filtered[0]; const rows = columns.map((column) => `| ${column.header} | ${String(item[column.key] ?? "")} |`); return { table: rows.join("\n"), footer: "" }; } const total = filtered.length; const display = filtered.slice(0, limit); const headers = ["#", ...columns.map((c) => c.header)]; const separator = headers.map(() => "---"); const rows = display.map((item, i) =>