Skip to main content
Glama
ckz

Education Data MCP Server

by ckz

get_education_data

Retrieve structured education data from the Urban Institute's API for schools, districts, and universities by specifying level, source, and topic parameters.

Instructions

Retrieve education data from the Urban Institute's Education Data API

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
levelYesAPI data level to query (e.g., 'schools', 'school-districts', 'college-university')
sourceYesAPI data source to query (e.g., 'ccd', 'ipeds', 'crdc')
topicYesAPI data topic to query (e.g., 'enrollment', 'directory')
subtopicNoOptional list of grouping parameters (e.g., ['race', 'sex'])
filtersNoOptional query filters (e.g., {year: 2008, grade: [9,10,11,12]})
add_labelsNoAdd variable labels when applicable (default: false)
limitNoLimit the number of results (default: 100)

Implementation Reference

  • The handler for the 'get_education_data' tool. It extracts parameters from the request, validates required fields (level, source, topic), constructs the API URL from https://educationdata.urban.org/api/v1 with subtopics, filters, limits, and labels, makes an axios GET request with mode=R, returns the JSON data as text content, and handles API errors like 404, 400, 413.
    case "get_education_data": {
      const { level, source, topic, subtopic, filters, add_labels, limit = 100 } = request.params.arguments || {};
      
      if (!level || !source || !topic) {
        throw new McpError(
          ErrorCode.InvalidParams,
          "Missing required parameters: level, source, and topic are required"
        );
      }
      
      try {
        // Construct the API URL
        let url = `${API_BASE_URL}/${level}/${source}/${topic}`;
        
        // Add subtopics if provided
        if (subtopic && Array.isArray(subtopic) && subtopic.length > 0) {
          url += `/${subtopic.join("/")}`;
        }
        
        // Add query parameters
        const queryParams = new URLSearchParams();
        queryParams.append("limit", String(limit));
        
        if (add_labels) {
          queryParams.append("add_labels", "true");
        }
        
        // Add filters
        if (filters && typeof filters === "object") {
          Object.entries(filters).forEach(([key, value]) => {
            if (Array.isArray(value)) {
              queryParams.append(key, value.join(","));
            } else {
              queryParams.append(key, String(value));
            }
          });
        }
        
        // Add mode=R to match the R package behavior
        queryParams.append("mode", "R");
        
        // Make the API request
        const response = await axios.get(`${url}?${queryParams.toString()}`);
        
        // Return the results
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(response.data.results || response.data, null, 2)
            }
          ]
        };
      } catch (error) {
        if (axios.isAxiosError(error)) {
          const statusCode = error.response?.status;
          const message = error.response?.data?.message || error.message;
          
          if (statusCode === 404) {
            throw new McpError(
              ErrorCode.InvalidRequest,
              `Endpoint not found: ${level}/${source}/${topic}`
            );
          } else if (statusCode === 400) {
            throw new McpError(
              ErrorCode.InvalidParams,
              `API error: ${message}`
            );
          } else if (statusCode === 413) {
            throw new McpError(
              ErrorCode.InvalidParams,
              "Your requested query returned too many records. Consider limiting the scope of your query."
            );
          }
          
          throw new McpError(
            ErrorCode.InternalError,
            `API error (${statusCode}): ${message}`
          );
        }
        
        throw new McpError(
          ErrorCode.InternalError,
          `Error: ${error instanceof Error ? error.message : String(error)}`
        );
      }
    }
  • Input schema for the get_education_data tool, defining properties like level, source, topic (required), subtopic, filters, add_labels, limit with types and descriptions.
    inputSchema: {
      type: "object",
      properties: {
        level: {
          type: "string",
          description: "API data level to query (e.g., 'schools', 'school-districts', 'college-university')"
        },
        source: {
          type: "string",
          description: "API data source to query (e.g., 'ccd', 'ipeds', 'crdc')"
        },
        topic: {
          type: "string",
          description: "API data topic to query (e.g., 'enrollment', 'directory')"
        },
        subtopic: {
          type: "array",
          items: {
            type: "string"
          },
          description: "Optional list of grouping parameters (e.g., ['race', 'sex'])"
        },
        filters: {
          type: "object",
          description: "Optional query filters (e.g., {year: 2008, grade: [9,10,11,12]})"
        },
        add_labels: {
          type: "boolean",
          description: "Add variable labels when applicable (default: false)"
        },
        limit: {
          type: "number",
          description: "Limit the number of results (default: 100)"
        }
      },
      required: ["level", "source", "topic"]
    }
  • src/index.ts:197-237 (registration)
    Registration of the get_education_data tool in the ListToolsRequestSchema handler, including name, description, and input schema.
    {
      name: "get_education_data",
      description: "Retrieve education data from the Urban Institute's Education Data API",
      inputSchema: {
        type: "object",
        properties: {
          level: {
            type: "string",
            description: "API data level to query (e.g., 'schools', 'school-districts', 'college-university')"
          },
          source: {
            type: "string",
            description: "API data source to query (e.g., 'ccd', 'ipeds', 'crdc')"
          },
          topic: {
            type: "string",
            description: "API data topic to query (e.g., 'enrollment', 'directory')"
          },
          subtopic: {
            type: "array",
            items: {
              type: "string"
            },
            description: "Optional list of grouping parameters (e.g., ['race', 'sex'])"
          },
          filters: {
            type: "object",
            description: "Optional query filters (e.g., {year: 2008, grade: [9,10,11,12]})"
          },
          add_labels: {
            type: "boolean",
            description: "Add variable labels when applicable (default: false)"
          },
          limit: {
            type: "number",
            description: "Limit the number of results (default: 100)"
          }
        },
        required: ["level", "source", "topic"]
      }
    },
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 retrieval operation but doesn't mention whether it's read-only, has rate limits, requires authentication, returns paginated results, or handles errors. For a data API tool with 7 parameters, this leaves significant behavioral gaps.

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 states exactly what the tool does without unnecessary words. It's appropriately sized for a data retrieval tool and front-loads the core functionality.

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 tool's complexity (7 parameters, no output schema, no annotations), the description is minimally adequate but leaves significant gaps. It identifies the data source but doesn't explain return formats, error handling, or how to interpret results. The combination of good schema coverage but missing behavioral context results in a borderline complete picture.

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 schema description coverage is 100%, so the schema already documents all parameters thoroughly. The description doesn't add any additional parameter semantics beyond what's in the schema, such as explaining relationships between parameters or providing usage examples. This meets the baseline expectation when schema coverage is complete.

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 verb 'retrieve' and resource 'education data' with specific source 'Urban Institute's Education Data API', making the purpose unambiguous. However, it doesn't distinguish this from its sibling tool 'get_education_data_summary', which likely provides aggregated or summarized data versus the raw retrieval described here.

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, including its sibling 'get_education_data_summary'. There's no mention of prerequisites, typical use cases, or contextual factors that would help an agent decide between this and other data retrieval options.

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/ckz/edu_data_mcp_server'

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