Skip to main content
Glama

strapi_get_components

Retrieve all components from Strapi CMS with paginated results, including component data and pagination metadata for efficient content management.

Instructions

Get all components from Strapi with pagination support. Returns both component data and pagination metadata (page, pageSize, total, pageCount).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
serverYesThe name of the server to connect to
pageYesPage number (starts at 1)
pageSizeYesNumber of items per page

Implementation Reference

  • Handler for 'strapi_get_components' tool: validates input, fetches components from Strapi API endpoint '/api/content-type-builder/components' with pagination parameters, adds pagination metadata, and returns formatted JSON response.
        // Validate input using Zod (with defaults applied)
        const validatedArgs = validateToolInput("strapi_get_components", args, requestId);
        const { server, page, pageSize } = validatedArgs;
        logger.startRequest(requestId, name, server);
        const params = {
            'pagination[page]': page.toString(),
            'pagination[pageSize]': pageSize.toString(),
        };
    
        const data = await makeStrapiRequest(server, "/api/content-type-builder/components", params, requestId);
    
        // Add pagination metadata to the response
        const response = {
            data: data,
            pagination: {
                page,
                pageSize,
                total: data.length,
                pageCount: Math.ceil(data.length / pageSize),
            },
        };
    
        result = {
            content: [
                {
                    type: "text",
                    text: JSON.stringify(response, null, 2),
                },
            ],
        };
    } else if (name === "strapi_rest") {
  • Zod schema for input validation of 'strapi_get_components' tool, defining server (required), page (default 1), and pageSize (default 25).
    // Schema for strapi_get_components tool
    const GetComponentsSchema = z.object({
        server: z.string().min(1, "Server name is required and cannot be empty"),
        page: z.union([
            z.number().int().min(1, "Page must be a positive integer"),
            z.string().transform((str, ctx) => {
                const num = parseInt(str);
                if (isNaN(num) || num < 1) {
                    ctx.addIssue({
                        code: z.ZodIssueCode.custom,
                        message: "Page must be a positive integer"
                    });
                    return z.NEVER;
                }
                return num;
            })
        ]).optional().default(1),
        pageSize: z.union([
            z.number().int().min(1, "Page size must be a positive integer"),
            z.string().transform((str, ctx) => {
                const num = parseInt(str);
                if (isNaN(num) || num < 1) {
                    ctx.addIssue({
                        code: z.ZodIssueCode.custom,
                        message: "Page size must be a positive integer"
                    });
                    return z.NEVER;
                }
                return num;
            })
        ]).optional().default(25)
    }).strict();
  • src/index.ts:1263-1286 (registration)
    Tool registration in ListToolsRequestSchema handler: defines name, description, and inputSchema for discovery by MCP clients.
    {
        name: "strapi_get_components",
        description: "Get all components from Strapi with pagination support. Returns both component data and pagination metadata (page, pageSize, total, pageCount).",
        inputSchema: {
            ...zodToJsonSchema(ToolSchemas.strapi_get_components),
            properties: {
                ...zodToJsonSchema(ToolSchemas.strapi_get_components).properties,
                server: {
                    ...zodToJsonSchema(ToolSchemas.strapi_get_components).properties.server,
                    description: "The name of the server to connect to"
                },
                page: {
                    ...zodToJsonSchema(ToolSchemas.strapi_get_components).properties.page,
                    description: "Page number (starts at 1)",
                    default: 1
                },
                pageSize: {
                    ...zodToJsonSchema(ToolSchemas.strapi_get_components).properties.pageSize,
                    description: "Number of items per page",
                    default: 25
                }
            }
        },
    },
  • src/index.ts:621-627 (registration)
    Central registry of tool schemas including GetComponentsSchema for 'strapi_get_components', used for validation and JSON schema conversion.
    const ToolSchemas = {
        strapi_list_servers: ListServersSchema,
        strapi_get_content_types: GetContentTypesSchema,
        strapi_get_components: GetComponentsSchema,
        strapi_rest: RestSchema,
        strapi_upload_media: UploadMediaSchema
    } as const;
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes the return format (component data and pagination metadata) and implies a read-only operation through 'Get'. However, it lacks details on error handling, authentication requirements, rate limits, or whether this operation is safe/destructive.

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

Conciseness5/5

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

The description is extremely concise and front-loaded: the first sentence states the core purpose and key feature (pagination), and the second sentence details the return format. Every sentence earns its place with zero wasted words, making it easy for an AI agent to parse quickly.

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

Completeness3/5

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

Given no annotations and no output schema, the description does a decent job by specifying the return format (component data + pagination metadata). However, for a tool with 3 parameters and no structured safety hints, it should ideally mention authentication, error cases, or operational constraints to be fully complete for agent 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 already documents all three parameters thoroughly. The description adds no additional parameter semantics beyond what's in the schema—it doesn't explain parameter interactions, default behaviors beyond defaults in schema, or usage examples. Baseline 3 is appropriate when schema does the heavy lifting.

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 ('Get') and resource ('all components from Strapi'), making the purpose immediately understandable. It distinguishes this from siblings like 'strapi_get_content_types' by specifying components rather than content types. However, it doesn't explicitly contrast with other sibling tools beyond the resource type.

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?

The description provides no guidance on when to use this tool versus alternatives like 'strapi_get_content_types' or 'strapi_rest'. It mentions pagination support but doesn't explain when paginated retrieval is preferred over other methods or what prerequisites might exist (e.g., server connectivity).

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

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/misterboe/strapi-mcp-server'

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