Skip to main content
Glama
peximo
by peximo

query_content

Search and filter Drupal content by type, title, or publication status to find specific nodes in your Drupal site.

Instructions

Search and filter Drupal content by type. Returns a list of nodes matching the criteria.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentTypeYesThe machine name of the content type (e.g., "article", "page", "blog_post")
limitNoMaximum number of results to return (default: 10)
titleNoFilter by title (partial match)
statusNoFilter by publication status (true = published, false = unpublished)

Implementation Reference

  • The handler function that executes the query_content tool logic by fetching content from Drupal's JSON:API.
    async queryContent(
        contentType: string,
        options: {
            limit?: number | undefined;
            title?: string | undefined;
            status?: boolean | undefined;
        } = {}
    ): Promise<DrupalNode[]> {
        try {
            // Build query parameters for JSON:API
            const params: any = {
                'page[limit]': options.limit || 10,
            };
    
            // Add filters if provided
            const filters: string[] = [];
            if (options.title) {
                params['filter[title][operator]'] = 'CONTAINS';
                params['filter[title][value]'] = options.title;
            }
            if (options.status !== undefined) {
                params['filter[status]'] = options.status ? '1' : '0';
            }
    
            // Make the request to JSON:API
            const response = await this.client.get<JsonApiResponse>(
                `/node/${contentType}`,
                { params }
            );
    
            // Return array of nodes (handle both single and multiple results)
            return Array.isArray(response.data.data)
                ? response.data.data
                : [response.data.data];
        } catch (error: any) {
            throw new Error(`Failed to query content: ${error.message}`);
        }
    }

Tool Definition Quality

Score is being calculated. Check back soon.

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/peximo/drupal-mcp-server'

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