Skip to main content
Glama
cdugo

DocsFetcher MCP Server

by cdugo

fetch-multilingual-docs

Fetch comprehensive package documentation across multiple programming languages like JavaScript, Python, and Java for LLM integration without API keys.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
packageNameYesName of the package to fetch documentation for
languagesYesList of programming languages or repository types to check (e.g., javascript, python, java)

Implementation Reference

  • The primary handler implementation for the 'fetch-multilingual-docs' tool. This inline function within the server.tool registration fetches package documentation across multiple languages, handles errors per language, selects the best result, and formats a summary with the content.
    server.tool(
      "fetch-multilingual-docs",
      {
        packageName: z
          .string()
          .describe("Name of the package to fetch documentation for"),
        languages: z
          .array(z.string())
          .describe(
            "List of programming languages or repository types to check (e.g., javascript, python, java)"
          ),
      },
      async ({ packageName, languages }) => {
        console.error(
          `Fetching documentation for package: ${packageName} across languages: ${languages.join(
            ", "
          )}`
        );
    
        const results: Record<string, any> = {};
        let hasSuccessfulFetch = false;
    
        for (const language of languages) {
          try {
            console.error(`Trying ${language} repository...`);
            const packageUrl = getPackageUrl(packageName, language);
    
            const documentationContent =
              await scraperService.fetchLibraryDocumentation(packageUrl);
    
            results[language] = {
              url: packageUrl,
              success: true,
              content: documentationContent,
            };
    
            hasSuccessfulFetch = true;
          } catch (error) {
            console.error(`Error fetching ${language} documentation:`, error);
            results[language] = {
              success: false,
              error: error instanceof Error ? error.message : String(error),
            };
          }
        }
    
        if (!hasSuccessfulFetch) {
          return {
            content: [
              {
                type: "text",
                text: `Failed to fetch documentation for ${packageName} in any of the requested languages: ${languages.join(
                  ", "
                )}.`,
              },
            ],
            isError: true,
          };
        }
    
        // Format the successful results
        const bestLanguage =
          Object.keys(results).find((lang) => results[lang].success) ||
          languages[0];
        const bestContent = results[bestLanguage].content;
    
        // Include a summary of all language results
        const summaryLines = [
          `## Documentation Search Results for '${packageName}'`,
        ];
        summaryLines.push("");
    
        for (const language of languages) {
          const result = results[language];
          if (result.success) {
            summaryLines.push(
              `✅ **${language}**: Successfully fetched documentation from ${result.url}`
            );
          } else {
            summaryLines.push(`❌ **${language}**: Failed - ${result.error}`);
          }
        }
    
        summaryLines.push("");
        summaryLines.push(`---`);
        summaryLines.push("");
        summaryLines.push(
          `# Documentation Content (from ${bestLanguage} repository)`
        );
        summaryLines.push("");
    
        const summary = summaryLines.join("\n");
        const completeContent = summary + bestContent;
    
        return {
          content: [
            {
              type: "text",
              text: completeContent,
            },
          ],
        };
      }
    );
Behavior1/5

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

Tool has no description.

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

Conciseness1/5

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

Tool has no description.

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

Completeness1/5

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

Tool has no description.

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

Parameters1/5

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

Tool has no description.

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

Purpose1/5

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

Tool has no description.

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

Usage Guidelines1/5

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

Tool has no description.

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/cdugo/package-documentation-mcp'

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