Skip to main content
Glama

generate_district_map

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); });

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