Get Collection
get_collectionRetrieve a complete collection including its field schema by specifying the collection slug, enabling structured data access from ElmapiCMS.
Instructions
Get a single collection with its full field schema by slug
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| slug | Yes | The collection slug (e.g. 'blog-posts') |
Implementation Reference
- src/tools/collections.ts:21-33 (handler)Complete implementation of get_collection tool: registration with title, description, input schema, and the handler function that makes a GET request to /collections/{slug} and returns JSON formatted results
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 definition for get_collection tool: accepts a slug parameter (string) describing the collection slug (e.g., 'blog-posts')
inputSchema: { slug: z.string().describe("The collection slug (e.g. 'blog-posts')"), }, - src/tools/collections.ts:28-33 (handler)Handler function that executes get_collection logic: destructures slug from input, makes GET request to /collections/${slug}, and returns the result as formatted JSON text content
}, async ({ slug }) => { const result = await client.get(`/collections/${slug}`); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], }; });