Skip to main content
Glama

generate_district_map

Read-only

Generate visual maps of Chinese administrative divisions to display regional data distribution or composition, such as GDP by province or city classifications.

Instructions

Generates regional distribution maps, which are usually used to show the administrative divisions and coverage of a dataset. It is not suitable for showing the distribution of specific locations, such as urban administrative divisions, GDP distribution maps of provinces and cities across the country, etc. This tool is limited to generating data maps within China.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleYesThe map title should not exceed 16 characters. The content should be consistent with the information the map wants to convey and should be accurate, rich, creative, and attractive.
dataYesAdministrative division data, lower-level administrative divisions are optional. There are usually two scenarios: one is to simply display the regional composition, only `fillColor` needs to be configured, and all administrative divisions are consistent, representing that all blocks are connected as one; the other is the regional data distribution scenario, first determine the `dataType`, `dataValueUnit` and `dataLabel` configurations, `dataValue` should be a meaningful value and consistent with the meaning of dataType, and then determine the style configuration. The `fillColor` configuration represents the default fill color for areas without data. Lower-level administrative divisions do not need `fillColor` configuration, and their fill colors are determined by the `colors` configuration (If `dataType` is "number", only one base color (warm color) is needed in the list to calculate the continuous data mapping color band; if `dataType` is "enum", the number of color values in the list is equal to the number of enumeration values (contrast colors)). If `subdistricts` has a value, `showAllSubdistricts` must be set to true. For example, {"title": "陕西省地级市分布图", "data": {"name": "陕西省", "showAllSubdistricts": true, "dataLabel": "城市", "dataType": "enum", "colors": ["#4ECDC4", "#A5D8FF"], "subdistricts": [{"name": "西安市", "dataValue": "省会"}, {"name": "宝鸡市", "dataValue": "地级市"}, {"name": "咸阳市", "dataValue": "地级市"}, {"name": "铜川市", "dataValue": "地级市"}, {"name": "渭南市", "dataValue": "地级市"}, {"name": "延安市", "dataValue": "地级市"}, {"name": "榆林市", "dataValue": "地级市"}, {"name": "汉中市", "dataValue": "地级市"}, {"name": "安康市", "dataValue": "地级市"}, {"name": "商洛市", "dataValue": "地级市"}]}, "width": 1000, "height": 1000}.
widthNoSet the width of map, default is 1600.
heightNoSet the height of map, default is 1000.

Implementation Reference

  • The generateMap function executes the core logic for map tools like generate_district_map by sending the tool name and input to the visualization service API, which generates the district map.
    export async function generateMap(
      tool: string,
      input: unknown,
    ): Promise<ResponseResult> {
      const url = getVisRequestServer();
    
      const response = await axios.post(
        url,
        {
          serviceId: getServiceIdentifier(),
          tool,
          input,
          source: "mcp-server-chart",
        },
        {
          headers: {
            "Content-Type": "application/json",
          },
        },
      );
      const { success, errorMessage, resultObj } = response.data;
    
      if (!success) {
        throw new Error(errorMessage);
      }
      return resultObj;
    }
  • Handler logic in callTool for map tools including generate_district_map: invokes generateMap with the tool name and arguments.
    if (isMapChartTool) {
      // For map charts, we use the generateMap function, and return the mcp result.
      const { metadata, ...result } = await generateMap(tool, args);
      return result;
    }
  • Tool schema and definition for generate_district_map, including Zod-based input schema converted to JSON schema.
    // https://modelcontextprotocol.io/specification/2025-03-26/server/tools#listing-tools
    const tool = {
      name: "generate_district_map",
      description:
        "Generates regional distribution maps, which are usually used to show the administrative divisions and coverage of a dataset. It is not suitable for showing the distribution of specific locations, such as urban administrative divisions, GDP distribution maps of provinces and cities across the country, etc. This tool is limited to generating data maps within China.",
      inputSchema: zodToJsonSchema(schema),
      annotations: {
        title: "Generate District Map",
        readOnlyHint: true,
      },
    };
  • src/server.ts:66-68 (registration)
    MCP listTools registration: collects and returns tool objects from all chart modules, including generate_district_map.tool
    server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: getEnabledTools().map((chart) => chart.tool),
    }));
  • src/server.ts:71-75 (registration)
    MCP callTool registration: handles tool calls by delegating to internal callTool utility.
    server.setRequestHandler(CallToolRequestSchema, async (request: any) => {
      logger.info("calling tool", request.params.name, request.params.arguments);
    
      return await callTool(request.params.name, request.params.arguments);
    });
Behavior3/5

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

Annotations declare readOnlyHint=true, indicating no destructive operations, which the description doesn't contradict. The description adds context about geographic limitations (China-only) and data suitability constraints, but doesn't disclose behavioral traits like rate limits, authentication needs, or output format details beyond what annotations provide.

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

Conciseness4/5

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

The description is front-loaded with purpose and limitations in three sentences, with no wasted words. Each sentence adds value: the first states what it does, the second clarifies scope, and the third sets geographic bounds. It could be slightly more structured but is efficient.

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 the complex input schema with nested objects and no output schema, the description is adequate but minimal. It covers purpose and constraints but doesn't explain the rich parameter interactions or expected output format, leaving gaps for a tool with such detailed schema requirements.

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?

With 100% schema description coverage, the schema already documents all parameters thoroughly. The description adds no parameter-specific information beyond what's in the schema, so it meets the baseline of 3 without compensating value. It implies geographic scope but doesn't elaborate on parameter usage.

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 tool generates 'regional distribution maps' for 'administrative divisions and coverage of a dataset' within China, which is a specific verb+resource. However, it doesn't explicitly differentiate from all sibling tools like 'generate_path_map' or 'generate_pin_map' that might also create maps, though it does distinguish from non-map siblings.

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

Usage Guidelines4/5

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

The description provides clear context on when to use ('show administrative divisions and coverage of a dataset within China') and when not to use ('not suitable for showing distribution of specific locations... urban administrative divisions, GDP distribution maps...'), with implicit alternatives being other map tools for different data types. It lacks explicit naming of alternatives like 'generate_pin_map' for point locations.

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/antvis/mcp-server-chart'

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