Skip to main content
Glama
srobbin

opengov-mcp-server

by srobbin

get_data

Access data and metadata from the City of Chicago Data Portal. List datasets, categories, or tags; retrieve metadata, column info, and data records with SoQL queries; get portal statistics.

Instructions

[City of Chicago | Data Portal] Access data and metadata to learn more about the city and its underlying information.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
typeYesThe type of operation to perform: - catalog: List datasets with optional search - categories: List all dataset categories - tags: List all dataset tags - dataset-metadata: Get detailed metadata for a specific dataset - column-info: Get column details for a specific dataset - data-access: Access records from a dataset (with query support) - site-metrics: Get portal-wide statistics
domainNoOptional domain (hostname only, without protocol). Used with all operation types.
queryNoSearch or query string with different uses depending on operation type: - For type=catalog: Search query to filter datasets - For type=data-access: SoQL query string for complex data filtering
datasetIdNoDataset identifier required for the following operations: - For type=dataset-metadata: Get dataset details - For type=column-info: Get column information - For type=data-access: Specify which dataset to query (e.g., 6zsd-86xi)
soqlQueryNoFor type=data-access only. Optional SoQL query string for filtering data. This is an alias for the query parameter and takes precedence if both are provided.
selectNoFor type=data-access only. Specifies which columns to return in the result set.
whereNoFor type=data-access only. Filters the rows to be returned (e.g., "magnitude > 3.0").
orderNoFor type=data-access only. Orders the results based on specified columns (e.g., "date DESC").
groupNoFor type=data-access only. Groups results for aggregate functions.
havingNoFor type=data-access only. Filters for grouped results, similar to where but for grouped data.
qNoFor type=data-access only. Full text search parameter for free-text searching across the dataset.
limitNoMaximum number of results to return: - For type=catalog: Limits dataset results - For type=data-access: Limits data records returned
offsetNoNumber of results to skip for pagination: - For type=catalog: Skips dataset results - For type=data-access: Skips data records for pagination

Implementation Reference

  • src/index.ts:50-55 (registration)
    Registration/call-site: Routes the 'get_data' tool call to handleSocrataTool in the CallToolRequestHandler
    if (name === 'get_data') {
      // Handle the unified data retrieval tool
      result = await handleSocrataTool(args || {});
    } else {
      throw new Error(`Unknown tool: ${name}`);
    }
  • Main handler for the get_data tool - routes to sub-handlers (catalog, categories, tags, dataset-metadata, column-info, data-access, site-metrics) based on the 'type' parameter
    export async function handleSocrataTool(params: Record<string, unknown>): Promise<unknown> {
      const { type } = params;
      
      switch (type) {
        case 'catalog':
          return handleCatalog(params as { query?: string; domain?: string; limit?: number; offset?: number });
        case 'categories':
          return handleCategories(params as { domain?: string });
        case 'tags':
          return handleTags(params as { domain?: string });
        case 'dataset-metadata':
          // Validate required parameters
          if (!params.datasetId) {
            throw new Error('datasetId is required for dataset-metadata operation');
          }
          return handleDatasetMetadata(params as { datasetId: string; domain?: string });
        case 'column-info':
          // Validate required parameters
          if (!params.datasetId) {
            throw new Error('datasetId is required for column-info operation');
          }
          return handleColumnInfo(params as { datasetId: string; domain?: string });
        case 'data-access':
          // Validate required parameters
          if (!params.datasetId) {
            throw new Error('datasetId is required for data-access operation');
          }
          // Map soqlQuery to query for consistency with the handler
          if (params.soqlQuery) {
            params.query = params.soqlQuery;
          }
          return handleDataAccess(params as { 
            datasetId: string; 
            domain?: string; 
            query?: string; 
            limit?: number; 
            offset?: number;
            select?: string;
            where?: string;
            order?: string;
            group?: string;
            having?: string;
            q?: string;
          });
        case 'site-metrics':
          return handleSiteMetrics(params as { domain?: string });
        default:
          throw new Error(`Unknown operation type: ${type}`);
      }
    }
  • Schema/Tool definition for 'get_data' - defines the unified tool with all input parameters
    export const UNIFIED_SOCRATA_TOOL: Tool = {
      name: 'get_data',
      description: 'Access data and metadata to learn more about the city and its underlying information.',
      inputSchema: {
        type: 'object',
        properties: {
          type: {
            type: 'string',
            enum: ['catalog', 'categories', 'tags', 'dataset-metadata', 'column-info', 'data-access', 'site-metrics'],
            description: 'The type of operation to perform:' +
              '\n- catalog: List datasets with optional search' +
              '\n- categories: List all dataset categories' + 
              '\n- tags: List all dataset tags' +
              '\n- dataset-metadata: Get detailed metadata for a specific dataset' +
              '\n- column-info: Get column details for a specific dataset' +
              '\n- data-access: Access records from a dataset (with query support)' +
              '\n- site-metrics: Get portal-wide statistics',
          },
          domain: {
            type: 'string',
            description: 'Optional domain (hostname only, without protocol). Used with all operation types.',
          },
          // Search and query parameters
          query: {
            type: 'string',
            description: 'Search or query string with different uses depending on operation type:' +
              '\n- For type=catalog: Search query to filter datasets' +
              '\n- For type=data-access: SoQL query string for complex data filtering',
          },
          // Dataset specific parameters
          datasetId: {
            type: 'string',
            description: 'Dataset identifier required for the following operations:' +
              '\n- For type=dataset-metadata: Get dataset details' +
              '\n- For type=column-info: Get column information' +
              '\n- For type=data-access: Specify which dataset to query (e.g., 6zsd-86xi)',
          },
          // Data access specific parameters
          soqlQuery: {
            type: 'string',
            description: 'For type=data-access only. Optional SoQL query string for filtering data.' +
              '\nThis is an alias for the query parameter and takes precedence if both are provided.',
          },
          // Additional SoQL parameters for data-access
          select: {
            type: 'string',
            description: 'For type=data-access only. Specifies which columns to return in the result set.',
          },
          where: {
            type: 'string',
            description: 'For type=data-access only. Filters the rows to be returned (e.g., "magnitude > 3.0").',
          },
          order: {
            type: 'string',
            description: 'For type=data-access only. Orders the results based on specified columns (e.g., "date DESC").',
          },
          group: {
            type: 'string',
            description: 'For type=data-access only. Groups results for aggregate functions.',
          },
          having: {
            type: 'string',
            description: 'For type=data-access only. Filters for grouped results, similar to where but for grouped data.',
          },
          // Full-text search parameter
          q: {
            type: 'string',
            description: 'For type=data-access only. Full text search parameter for free-text searching across the dataset.',
          },
          // Pagination parameters
          limit: {
            type: 'number',
            description: 'Maximum number of results to return:' +
              '\n- For type=catalog: Limits dataset results' +
              '\n- For type=data-access: Limits data records returned',
            default: 10,
          },
          offset: {
            type: 'number',
            description: 'Number of results to skip for pagination:' +
              '\n- For type=catalog: Skips dataset results' +
              '\n- For type=data-access: Skips data records for pagination',
            default: 0,
          },
        },
        required: ['type'],
        additionalProperties: false,
      },
    };
  • Helper: handleCatalog - sub-handler for the 'catalog' operation type (list datasets with optional search)
    async function handleCatalog(params: { 
      query?: string; 
      domain?: string;
      limit?: number; 
      offset?: number; 
    }): Promise<DatasetMetadata[]> {
      const { query, domain = getDefaultDomain(), limit = 10, offset = 0 } = params;
      
      const apiParams: Record<string, unknown> = {
        limit,
        offset,
        search_context: domain // Add search_context parameter with the domain
      };
      
      if (query) {
        apiParams.q = query;
      }
    
      const baseUrl = `https://${domain}`;
      const response = await fetchFromSocrataApi<{ results: DatasetMetadata[] }>(
        '/api/catalog/v1', 
        apiParams,
        baseUrl
      );
      
      return response.results;
    }
  • Helper: handleSiteMetrics - sub-handler for the 'site-metrics' operation type (get portal-wide statistics)
    async function handleSiteMetrics(params: { 
      domain?: string; 
    }): Promise<PortalMetrics> {
      const { domain = getDefaultDomain() } = params;
      
      const baseUrl = `https://${domain}`;
      const response = await fetchFromSocrataApi<PortalMetrics>(
        '/api/site_metrics.json', 
        {},
        baseUrl
      );
      
      return response;
    }
Behavior2/5

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

No annotations are provided, so the description should disclose behavioral traits. It fails to mention that the tool supports multiple operation types, is read-only (implied but not stated), or any other behavioral aspects beyond a generic 'access data and metadata'.

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

Conciseness2/5

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

The description is a single vague sentence. While it is concise, it is under-specified and does not effectively convey the tool's capabilities.

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

Completeness1/5

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

Given the tool's complexity (13 parameters, multiple operation types, no output schema), the description is extremely incomplete. It does not explain the different operations, query syntax, or return values, leaving the agent with almost no useful context.

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?

Schema coverage is 100%, so baseline is 3. The description adds no parameter context beyond what the schema already provides.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose2/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description is vague: 'Access data and metadata to learn more about the city and its underlying information.' It does not specify the specific actions or resources available, despite the schema supporting many operations like 'catalog', 'data-access', etc.

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?

No guidance on when to use this tool versus alternatives, nor any context on when not to use it. The description provides no usage context despite the diverse operations.

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/srobbin/opengov-mcp-server'

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