Skip to main content
Glama
ckz

Education Data MCP Server

by ckz

get_education_data_summary

Retrieve aggregated education statistics from the Urban Institute's API to analyze data on schools, districts, and universities by applying filters and grouping variables.

Instructions

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
levelYesAPI data level to query
sourceYesAPI data source to query
topicYesAPI data topic to query
subtopicNoOptional additional parameters (only applicable to certain endpoints)
statYesSummary statistic to calculate (e.g., 'sum', 'avg', 'count', 'median')
varYesVariable to be summarized
byYesVariables to group results by
filtersNoOptional query filters

Implementation Reference

  • Handler for the 'get_education_data_summary' tool. Parses arguments, validates required params (level, source, topic, stat, var, by), constructs API URL with /summaries endpoint, adds query parameters for stat, var, by, filters, and makes GET request to Education Data API. Handles errors with appropriate MCP errors.
    case "get_education_data_summary": {
      const args = request.params.arguments || {};
      const level = String(args.level || '');
      const source = String(args.source || '');
      const topic = String(args.topic || '');
      const subtopic = args.subtopic ? String(args.subtopic) : undefined;
      const stat = String(args.stat || '');
      const variable = String(args.var || '');
      const by = args.by || [];
      const filters = args.filters || {};
      
      if (!level || !source || !topic || !stat || !variable || !by) {
        throw new McpError(
          ErrorCode.InvalidParams,
          "Missing required parameters: level, source, topic, stat, var, and by are required"
        );
      }
      
      try {
        // Construct the API URL
        let url = `${API_BASE_URL}/${level}/${source}/${topic}`;
        
        // Add subtopic if provided
        if (subtopic) {
          url += `/${subtopic}`;
        }
        
        // Add summaries endpoint
        url += "/summaries";
        
        // Add query parameters
        const queryParams = new URLSearchParams();
        queryParams.append("stat", stat);
        queryParams.append("var", variable);
        
        if (Array.isArray(by)) {
          queryParams.append("by", by.join(","));
        } else {
          queryParams.append("by", String(by));
        }
        
        // 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,
              `Summary endpoint not found: ${level}/${source}/${topic}${subtopic ? `/${subtopic}` : ''}/summaries`
            );
          } else if (statusCode === 400) {
            throw new McpError(
              ErrorCode.InvalidParams,
              `API error: ${message}`
            );
          }
          
          throw new McpError(
            ErrorCode.InternalError,
            `API error (${statusCode}): ${message}`
          );
        }
        
        throw new McpError(
          ErrorCode.InternalError,
          `Error: ${error instanceof Error ? error.message : String(error)}`
        );
      }
    }
  • Input schema definition for the 'get_education_data_summary' tool, including properties for level, source, topic, subtopic, stat, var, by, filters, with required fields specified.
    {
      name: "get_education_data_summary",
      description: "Retrieve aggregated education data from the Urban Institute's Education Data API",
      inputSchema: {
        type: "object",
        properties: {
          level: {
            type: "string",
            description: "API data level to query"
          },
          source: {
            type: "string",
            description: "API data source to query"
          },
          topic: {
            type: "string",
            description: "API data topic to query"
          },
          subtopic: {
            type: "string",
            description: "Optional additional parameters (only applicable to certain endpoints)"
          },
          stat: {
            type: "string",
            description: "Summary statistic to calculate (e.g., 'sum', 'avg', 'count', 'median')"
          },
          var: {
            type: "string",
            description: "Variable to be summarized"
          },
          by: {
            type: "array",
            items: {
              type: "string"
            },
            description: "Variables to group results by"
          },
          filters: {
            type: "object",
            description: "Optional query filters"
          }
        },
        required: ["level", "source", "topic", "stat", "var", "by"]
      }
    }
  • src/index.ts:194-285 (registration)
    Registration of the 'get_education_data_summary' tool in the list_tools response handler, including its name, description, and input schema.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: [
          {
            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"]
            }
          },
          {
            name: "get_education_data_summary",
            description: "Retrieve aggregated education data from the Urban Institute's Education Data API",
            inputSchema: {
              type: "object",
              properties: {
                level: {
                  type: "string",
                  description: "API data level to query"
                },
                source: {
                  type: "string",
                  description: "API data source to query"
                },
                topic: {
                  type: "string",
                  description: "API data topic to query"
                },
                subtopic: {
                  type: "string",
                  description: "Optional additional parameters (only applicable to certain endpoints)"
                },
                stat: {
                  type: "string",
                  description: "Summary statistic to calculate (e.g., 'sum', 'avg', 'count', 'median')"
                },
                var: {
                  type: "string",
                  description: "Variable to be summarized"
                },
                by: {
                  type: "array",
                  items: {
                    type: "string"
                  },
                  description: "Variables to group results by"
                },
                filters: {
                  type: "object",
                  description: "Optional query filters"
                }
              },
              required: ["level", "source", "topic", "stat", "var", "by"]
            }
          }
        ]
      };
    });
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 the tool retrieves aggregated data but doesn't mention critical behavioral aspects like whether it's read-only, potential rate limits, authentication requirements, error handling, or the format/scope of returned data. This leaves significant gaps for a tool with 8 parameters.

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 directly states the tool's purpose without unnecessary words. It's appropriately sized and front-loaded with the core functionality, making it easy to parse quickly.

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

Completeness2/5

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

For a tool with 8 parameters, no annotations, and no output schema, the description is insufficiently complete. It doesn't explain what 'aggregated' means in practice, doesn't address the sibling tool relationship, and provides no behavioral context. The agent would struggle to use this tool effectively without additional information.

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 all parameters are documented in the schema. The description adds no additional parameter semantics beyond implying aggregation occurs, which is already clear from the schema's parameter descriptions (e.g., 'stat' for summary statistics). This meets the baseline for high schema coverage.

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 action ('Retrieve aggregated education data') and the source ('Urban Institute's Education Data API'), which is specific and informative. However, it doesn't explicitly distinguish this tool from its sibling 'get_education_data', leaving some ambiguity about when to use one versus the other.

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 its sibling 'get_education_data' or any alternatives. It lacks context about appropriate use cases, prerequisites, or exclusions, leaving the agent with no usage direction beyond the basic purpose.

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