Skip to main content
Glama

get_entries

Retrieve entries from a specified content type with advanced filtering, sorting, and pagination options. Include related data, global field schemas, and metadata for comprehensive content management.

Instructions

Retrieves entries for a specified content type, with extensive options for filtering, sorting, pagination, and including related data.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ascNoSort entries in ascending order by the specified field UID
content_type_uidYesContent type UID to fetch entries from
descNoSort entries in descending order by the specified field UID
exceptNoExclude specified top-level fields from the response
include_countNoInclude total count of entries
include_global_field_schemaNoInclude global field schema
include_metadataNoInclude metadata in the response
include_ownerNoInclude owner information in the response
include_publish_detailsNoInclude publish details in the response
include_referenceNoReferences to include
include_reference_content_type_uidNoInclude content type UIDs in references
include_schemaNoInclude content type schema
limitNoNumber of entries to return (max 100)
localeNoLocale code (e.g., 'en-us')
onlyNoInclude only specified top-level fields in the response
queryNoQuery in JSON format to filter entries
skipNoNumber of entries to skip (for pagination)

Implementation Reference

  • The handler function for the 'get_entries' tool. Constructs a Contentstack API URL with extensive query parameters for filtering, sorting, pagination, references, and more. Fetches entries and formats the response with summaries for large result sets.
    async ({
      content_type_uid,
      locale,
      query,
      include_count,
      skip,
      limit,
      include_reference,
      include_reference_content_type_uid,
      include_schema,
      include_global_field_schema,
      asc,
      desc,
      only,
      except,
      include_metadata,
      include_publish_details,
      include_owner,
    }) => {
      try {
        const url = new URL(`${API_BASE_URL}/content_types/${content_type_uid}/entries`)
    
        // Add query parameters if provided
        if (locale) {
          url.searchParams.append('locale', locale)
        }
    
        if (query) {
          url.searchParams.append('query', query)
        }
    
        if (include_count) {
          url.searchParams.append('include_count', 'true')
        }
    
        if (skip > 0) {
          url.searchParams.append('skip', skip.toString())
        }
    
        if (limit !== 100) {
          url.searchParams.append('limit', limit.toString())
        }
    
        if (include_reference && include_reference.length > 0) {
          url.searchParams.append('include[]', include_reference.join(','))
        }
    
        if (include_reference_content_type_uid) {
          url.searchParams.append('include_reference_content_type_uid', 'true')
        }
    
        if (include_schema) {
          url.searchParams.append('include_schema', 'true')
        }
    
        if (include_global_field_schema) {
          url.searchParams.append('include_global_field_schema', 'true')
        }
    
        if (asc) {
          url.searchParams.append('asc', asc)
        }
    
        if (desc) {
          url.searchParams.append('desc', desc)
        }
    
        if (only && only.length > 0) {
          url.searchParams.append('only[BASE][]', only.join(','))
        }
    
        if (except && except.length > 0) {
          url.searchParams.append('except[BASE][]', except.join(','))
        }
    
        if (include_metadata) {
          url.searchParams.append('include_metadata', 'true')
        }
    
        if (include_publish_details) {
          url.searchParams.append('include_publish_details', 'true')
        }
    
        if (include_owner) {
          url.searchParams.append('include_owner', 'true')
        }
    
        const response = await axios.get<EntriesResponse>(url.toString(), {
          headers: getHeaders(),
        })
    
        // Format the response
        let formattedResponse = ''
    
        if (include_count && response.data.count) {
          formattedResponse += `Total entries: ${response.data.count}\n\n`
        }
    
        formattedResponse += `Entries retrieved: ${response.data.entries.length}\n\n`
    
        if (response.data.entries.length > 0) {
          // For large result sets, show a summary instead of all data
          if (response.data.entries.length > 10) {
            formattedResponse += 'First 10 entries (showing UIDs):\n'
            for (let i = 0; i < 10; i++) {
              const entry = response.data.entries[i]
              formattedResponse += `${i + 1}. ${entry.uid} - ${entry.title || '[No title]'}\n`
            }
            formattedResponse += `\n(${response.data.entries.length - 10} more entries not shown)\n\n`
            formattedResponse += `Full response data:\n${JSON.stringify(response.data, null, 2)}`
          } else {
            formattedResponse += `Entries:\n${JSON.stringify(response.data.entries, null, 2)}`
          }
        } else {
          formattedResponse += 'No entries found matching the criteria.'
        }
    
        return {
          content: [
            {
              type: 'text',
              text: formattedResponse,
            },
          ],
        }
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: `Error retrieving entries: ${handleError(error as ApiError)}`,
            },
          ],
          isError: true,
        }
      }
    },
  • Input schema using Zod for validating parameters to the get_entries tool, supporting comprehensive querying options.
    {
      content_type_uid: z.string().describe('Content type UID to fetch entries from'),
      locale: z.string().optional().describe("Locale code (e.g., 'en-us')"),
      query: z.string().optional().describe('Query in JSON format to filter entries'),
      include_count: z.boolean().optional().default(false).describe('Include total count of entries'),
      skip: z.number().optional().default(0).describe('Number of entries to skip (for pagination)'),
      limit: z.number().optional().default(100).describe('Number of entries to return (max 100)'),
      include_reference: z.array(z.string()).optional().describe('References to include'),
      include_reference_content_type_uid: z
        .boolean()
        .optional()
        .default(false)
        .describe('Include content type UIDs in references'),
      include_schema: z.boolean().optional().default(false).describe('Include content type schema'),
      include_global_field_schema: z.boolean().optional().default(false).describe('Include global field schema'),
      asc: z.string().optional().describe('Sort entries in ascending order by the specified field UID'),
      desc: z.string().optional().describe('Sort entries in descending order by the specified field UID'),
      only: z.array(z.string()).optional().describe('Include only specified top-level fields in the response'),
      except: z.array(z.string()).optional().describe('Exclude specified top-level fields from the response'),
      include_metadata: z.boolean().optional().default(false).describe('Include metadata in the response'),
      include_publish_details: z.boolean().optional().default(false).describe('Include publish details in the response'),
      include_owner: z.boolean().optional().default(false).describe('Include owner information in the response'),
    },
  • TypeScript interface defining the expected response structure from the Contentstack entries API, used in the handler.
    export interface EntriesResponse {
      entries: Entry[]
      count?: number
    }
  • src/index.ts:908-909 (registration)
    Registration of the 'get_entries' tool on the MCP server.
    server.tool(
      'get_entries',
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but lacks behavioral details. It mentions filtering, sorting, pagination, and including related data, but doesn't disclose rate limits, authentication requirements, error conditions, or response format. For a read operation with 17 parameters, this leaves significant gaps in understanding how the tool behaves.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose and lists key capabilities. It avoids redundancy and wastes no words, though it could be slightly more structured by separating different functional aspects.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a complex tool with 17 parameters, no annotations, and no output schema, the description is insufficient. It doesn't explain the return format, error handling, or practical usage examples. Given the richness of the input schema and lack of other structured data, more context is needed to guide effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents all 17 parameters. The description adds minimal value by summarizing the types of options (filtering, sorting, pagination, including related data) but doesn't provide additional syntax, format, or usage details beyond what's in the schema. This meets the baseline for high coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('retrieves') and resource ('entries for a specified content type'), making the purpose evident. It distinguishes from siblings like 'get_entry' (singular) by implying multiple entries, but doesn't explicitly contrast with 'get_all_content_types' or 'get_content_type' which retrieve different resources.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives like 'get_entry' (for a single entry) or 'get_all_content_types' (for content types rather than entries). The description mentions extensive options but doesn't specify scenarios or prerequisites for usage.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related 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/darekrossman/contentstack-mcp'

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