Skip to main content
Glama
DumplingAI

Dumpling AI MCP Server

Official
by DumplingAI

get-autocomplete

Retrieve Google autocomplete suggestions for search queries to understand user intent and popular search trends.

Instructions

Retrieve Google autocomplete suggestions for a query.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query
locationNoLocation name
countryNoCountry code (e.g., 'us')
languageNoLanguage code (e.g., 'en')

Implementation Reference

  • Handler function that proxies the request to Dumpling AI's get-autocomplete API endpoint, requiring DUMPLING_API_KEY environment variable, and returns the JSON response as MCP content.
    async ({ query, location, country, language }) => {
      const apiKey = process.env.DUMPLING_API_KEY;
      if (!apiKey) throw new Error("DUMPLING_API_KEY not set");
      const response = await fetch(`${NWS_API_BASE}/api/v1/get-autocomplete`, {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
          Authorization: `Bearer ${apiKey}`,
        },
        body: JSON.stringify({ query, location, country, language }),
      });
      if (!response.ok)
        throw new Error(`Failed: ${response.status} ${await response.text()}`);
      const data = await response.json();
      return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
    }
  • Input schema using Zod validation for the tool parameters.
      query: z.string().describe("Search query"),
      location: z.string().optional().describe("Location name"),
      country: z.string().optional().describe("Country code (e.g., 'us')"),
      language: z.string().optional().describe("Language code (e.g., 'en')"),
    },
  • src/index.ts:139-164 (registration)
    Full registration of the 'get-autocomplete' MCP tool using McpServer.tool method, including name, description, input schema, and handler implementation.
    server.tool(
      "get-autocomplete",
      "Retrieve Google autocomplete suggestions for a query.",
      {
        query: z.string().describe("Search query"),
        location: z.string().optional().describe("Location name"),
        country: z.string().optional().describe("Country code (e.g., 'us')"),
        language: z.string().optional().describe("Language code (e.g., 'en')"),
      },
      async ({ query, location, country, language }) => {
        const apiKey = process.env.DUMPLING_API_KEY;
        if (!apiKey) throw new Error("DUMPLING_API_KEY not set");
        const response = await fetch(`${NWS_API_BASE}/api/v1/get-autocomplete`, {
          method: "POST",
          headers: {
            "Content-Type": "application/json",
            Authorization: `Bearer ${apiKey}`,
          },
          body: JSON.stringify({ query, location, country, language }),
        });
        if (!response.ok)
          throw new Error(`Failed: ${response.status} ${await response.text()}`);
        const data = await response.json();
        return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
      }
    );

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/DumplingAI/mcp-server-dumplingai'

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