Skip to main content
Glama

get-content-types

Retrieve content type definitions from Contentful CMS to understand available content structures and fields for managing content.

Instructions

get content types

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • src/index.ts:36-76 (registration)
    Registration of the 'get-content-types' tool, including its inline handler. The handler fetches content types from the Contentful API using the provided space ID, environment, and access token, maps to id and name, and returns as formatted JSON text or error message.
    server.tool("get-content-types", "get content types", {}, async () => { const restEndpoint = `https://cdn.contentful.com/spaces/${CONTENTFUL_SPACE_ID}/environments/${CONTENTFUL_ENVIRONMENT}/content_types`; try { const response = await fetch(restEndpoint, { headers: { Authorization: `Bearer ${CONTENTFUL_ACCESS_TOKEN}`, }, }); if (!response.ok) { throw new Error(`http error! status ${response.status}`); } const data = await response.json(); return { content: [ { type: "text", text: JSON.stringify( data.items.map((item: any) => ({ id: item.sys.id, name: item.name, })), null, 2 ), }, ], }; } catch (error: any) { console.error("Error fetching content types:", error); return { content: [ { type: "text", text: `Error: ${error.message}`, }, ], }; } });

Other Tools

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/tejedamiguel6/MCP-server-Contenful'

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