Get Collection
get_collectionRetrieve a single collection and its complete field schema using its unique slug.
Instructions
Get a single collection with its full field schema by slug
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| slug | Yes | The collection slug (e.g. 'blog-posts') |
Implementation Reference
- src/tools/collections.ts:20-33 (handler)The handler function for the 'get_collection' tool. It takes a slug parameter via destructuring, makes a GET request to `/collections/${slug}` using the ElmapiClient, and returns the result as JSON text content.
// ── get_collection ──────────────────────────────────────────────── server.registerTool("get_collection", { title: "Get Collection", description: "Get a single collection with its full field schema by slug", inputSchema: { slug: z.string().describe("The collection slug (e.g. 'blog-posts')"), }, }, async ({ slug }) => { const result = await client.get(`/collections/${slug}`); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], }; }); - src/tools/collections.ts:25-27 (schema)Input schema for 'get_collection' defined within the registration call. Requires a single 'slug' parameter of type string, documented with 'The collection slug (e.g. 'blog-posts')'.
inputSchema: { slug: z.string().describe("The collection slug (e.g. 'blog-posts')"), }, - src/tools/collections.ts:21-33 (registration)Registration of the 'get_collection' tool via server.registerTool(), with title 'Get Collection' and description 'Get a single collection with its full field schema by slug'.
server.registerTool("get_collection", { title: "Get Collection", description: "Get a single collection with its full field schema by slug", inputSchema: { slug: z.string().describe("The collection slug (e.g. 'blog-posts')"), }, }, async ({ slug }) => { const result = await client.get(`/collections/${slug}`); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], }; }); - src/index.ts:36-39 (registration)Top-level registration call that invokes registerCollectionTools(server, client), which registers all collection tools including 'get_collection'.
registerCollectionTools(server, client); registerFieldTools(server, client); registerContentTools(server, client); registerAssetTools(server, client);