Skip to main content
Glama

nhgis_extract_to_code

Generate ready-to-run R or Python code from an NHGIS extract number to replicate the same data request.

Instructions

Generate ready-to-run R (ipumsr) and/or Python (ipumspy) code to reproduce an NHGIS extract. Fetches the extract definition by number and emits code that re-submits the same request. Use this after nhgis_create_extract to capture a reproducible workflow.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
languageNoOutput language(s): 'r', 'python', or 'both' (default: 'both')both
extractNumberYesNHGIS extract number to generate code for
Behavior4/5

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

With no annotations, the description carries the burden. It discloses that the tool 'Fetches the extract definition by number and emits code that re-submits the same request,' clarifying it does not itself submit the extract but only generates code. This is a key behavioral nuance beyond the input schema.

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 three sentences, leading with the primary purpose. No filler or repetition. Every sentence adds value: what it does, how it works, and when to use it.

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

Completeness5/5

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

The tool is a simple code generator: given an extract number and optional language, it returns ready-to-run code. The description covers the output's purpose and usage context. Without an output schema, the description adequately conveys the functional scope; no critical behavioral gaps remain.

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%: both language and extractNumber have descriptive text in the schema. The description does not add parameter semantics beyond what the schema already provides, so the baseline 3 applies.

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

Purpose5/5

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

The description opens with a specific verb+resource: 'Generate ready-to-run R (ipumsr) and/or Python (ipumspy) code to reproduce an NHGIS extract.' It clearly differentiates from sibling microdata_extract_to_code by explicitly naming NHGIS and the relevant R/Python packages.

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 says 'Use this after nhgis_create_extract to capture a reproducible workflow,' providing explicit when-to-use context. It does not mention when-not-to-use or name alternatives explicitly, but the NHGIS qualifier and relationship to create_extract imply exclusion of non-NHGIS contexts.

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/hesscl/ipums-mcp'

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