Skip to main content
Glama

microdata_extract_to_code

Reproduce an IPUMS microdata extract by generating ready-to-run R or Python code from the extract number, making workflows repeatable.

Instructions

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
languageNoOutput language(s): 'r', 'python', or 'both' (default: 'both')both
collectionYesIPUMS microdata collection (e.g. 'usa', 'cps')
extractNumberYesExtract number to generate code for
Behavior4/5

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

With no annotations provided, the description carries the behavioral burden. It clearly discloses that the tool 'fetches the extract definition by number' and 'emits code that re-submits the same request,' implying a read-only code-generation behavior. It does not detail side effects, authentication requirements, or error scenarios, but the core behavior is transparent.

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, each earning its place: first states the purpose, second explains the mechanism, third provides workflow timing. It is front-loaded with the core action and contains no filler.

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

Completeness4/5

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

Given no output schema and no annotations, the description adequately covers the tool's role in the workflow (after create, before download), names the supported languages, and clarifies that it produces re-runnable code. It does not describe return format or edge cases, but these are not critical for using the tool correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the baseline is 3. The description adds meaning by mapping 'R (ipumsr)' and 'Python (ipumspy)' to the language enum and explaining 'extract number' as the identifier for reproducing a request. This goes slightly beyond the schema's own descriptions.

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 a microdata extract.' It clearly states the tool's function and distinguishes it from sibling tools like microdata_get_extract (which returns metadata) or microdata_download_extract (which downloads data), focusing on code generation for reproducibility.

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 explicitly says 'Use this after microdata_create_extract to capture a reproducible workflow,' giving a clear sequential context. However, it does not name alternative tools or explicitly state when not to use it, so there is room for stronger guidance relative to siblings.

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