Skip to main content
Glama
Cleversoft-IT

drupal-modules-mcp MCP Server

get_module_info

Retrieve detailed Drupal module information from drupal.org by inputting the module's machine name, enabling quick access to essential data for development and configuration.

Instructions

Get information about a Drupal module from drupal.org

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
module_nameYesMachine name of the Drupal module

Implementation Reference

  • MCP CallToolRequestSchema handler that dispatches to get_module_info tool logic: validates tool name and arguments, invokes fetchModuleInfo, and returns JSON-formatted result as text content.
            async (request) => {
                if (request.params.name !== "get_module_info") {
                    throw new McpError(
                        ErrorCode.MethodNotFound,
                        `Unknown tool: ${request.params.name}`
                    );
                }
    
                const args = request.params.arguments as {
                    module_name: string;
                };
                if (!args.module_name) {
                    throw new McpError(
                        ErrorCode.InvalidParams,
                        "Module name is required"
                    );
                }
    
                try {
                    const moduleInfo = await this.fetchModuleInfo(
                        args.module_name
                    );
                    return {
                        content: [
                            {
                                type: "text",
                                text: JSON.stringify(moduleInfo, null, 2),
                            },
                        ],
                    };
                } catch (error) {
                    if (axios.isAxiosError(error)) {
                        throw new McpError(
                            ErrorCode.InternalError,
                            `Failed to fetch module info: ${error.message}`
                        );
                    }
                    throw error;
                }
            }
        );
    }
  • Core helper function that performs web scraping on drupal.org to retrieve and parse detailed module information into a ModuleInfo object.
    private async fetchModuleInfo(moduleName: string): Promise<ModuleInfo> {
        const url = `https://www.drupal.org/project/${moduleName}`;
        const response = await axios.get(url);
        const $ = cheerio.load(response.data);
    
        // Get the latest recommended version
        const latestVersion = $(
            ".release.recommended-Yes .views-field-field-release-version strong"
        )
            .first()
            .text()
            .trim();
    
        // Get Drupal compatibility from the release info
        const compatibility = $(
            ".release.recommended-Yes div:contains('Works with Drupal:')"
        )
            .first()
            .text()
            .replace("Works with Drupal:", "")
            .trim()
            .split("||")
            .map((v) => v.trim());
    
        // Get description from meta tag since it's cleaner
        const description = $('meta[name="description"]').attr("content") || "";
    
        const info: ModuleInfo = {
            name: $("#page-title").text().replace("| Drupal.org", "").trim(),
            description: description,
            version: latestVersion,
            downloads:
                $(".project-info li:contains('sites report')")
                    .text()
                    .match(/\d+,\d+/)?.[0] || "0",
            status: $(".project-info li:contains('Module categories')")
                .text()
                .replace("Module categories:", "")
                .trim(),
            composerCommand: $(`.drupalorg-copy.composer-command`)
                .first()
                .text()
                .trim(),
            drupalCompatibility: compatibility,
            projectUrl: url,
            readme: (() => {
                const $body = $(".field-name-body");
                // Replace each link with text+url format
                $body.find("a").each((_, elem) => {
                    const $elem = $(elem);
                    const href = $elem.attr("href");
                    const text = $elem.text().trim();
                    $elem.replaceWith(`${text} (${href})`);
                });
                return $body.text().trim();
            })(),
        };
    
        // Add additional compatibility info from release table
        const releaseInfo = $(
            ".table-release-compatibility-current tbody tr"
        ).first();
        if (releaseInfo.length) {
            const releaseCompatibility = releaseInfo
                .find("td")
                .map((_, elem) => $(elem).text().trim())
                .get();
            info.drupalCompatibility = [
                ...new Set([
                    ...info.drupalCompatibility,
                    ...releaseCompatibility,
                ]),
            ];
        }
    
        return info;
    }
  • src/index.ts:51-71 (registration)
    Registers the 'get_module_info' tool in the ListToolsRequestSchema handler, including its name, description, and input schema.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => ({
        tools: [
            {
                name: "get_module_info",
                description:
                    "Get information about a Drupal module from drupal.org",
                inputSchema: {
                    type: "object",
                    properties: {
                        module_name: {
                            type: "string",
                            description:
                                "Machine name of the Drupal module",
                        },
                    },
                    required: ["module_name"],
                },
            },
        ],
    }));
  • TypeScript interface defining the output structure of the get_module_info tool response.
    interface ModuleInfo {
        name: string;
        description: string;
        version: string;
        downloads: string;
        status: string;
        composerCommand: string;
        drupalCompatibility: string[];
        projectUrl: string;
        readme: string;
    }
Behavior2/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 states this is a read operation ('Get information'), but doesn't mention potential rate limits, authentication requirements, error conditions, or what format the information is returned in. This leaves significant gaps for an agent to understand how to use it effectively.

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 a single, efficient sentence that communicates the core purpose without any wasted words. It's appropriately sized for a simple tool with one parameter and gets straight to the point.

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 tool with no annotations and no output schema, the description is insufficient. It doesn't explain what information is returned, potential limitations, or error handling. While the purpose is clear, the behavioral context is too sparse for an agent to use this tool confidently.

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?

The input schema has 100% description coverage, clearly documenting the single required parameter. The description adds no additional parameter information beyond what's in the schema, so it meets the baseline of 3 where the 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 action ('Get information') and the resource ('a Drupal module from drupal.org'), making the purpose immediately understandable. It doesn't need to differentiate from siblings since none exist, but it could be slightly more specific about what type of information is retrieved.

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, prerequisites, or limitations. It simply states what the tool does without context about appropriate use cases or constraints.

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/Cleversoft-IT/drupal-modules-mcp'

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