Skip to main content
Glama
Internamaro Apify Data MCP

Internamaro Apify Data MCP

Flatten JSON

flatten_json
Read-only

Flatten nested JSON from pasted items, a JSON/NDJSON URL or an Apify dataset into one row per item, with keys like address.city ready for CSV or spreadsheets.

Instructions

Returns one flat item per input item: nested keys become columns like address.city, ready for CSV or a spreadsheet. Flattens nested JSON from pasted items, a JSON/NDJSON URL or an Apify dataset. You choose the key separator, how arrays are written and how deep to flatten. Give at least one of: items or jsonUrl or datasetId. Runs the Apify Actor ucchiii/flatten-json on YOUR Apify account (APIFY_TOKEN); you pay that Actor's pay-per-event price, see https://apify.com/ucchiii/flatten-json.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "flatten_json"
  }
}

Input Schema

NameRequiredDescriptionDefault
itemsNoA JSON array of objects to flatten, for example an API response you copied (up to 10,000 items).
arraysNoHow a list is written into its one column. 'join' joins plain values with the join separator; lists that hold objects stay JSON text either way. Empty lists become empty cells.json
jsonUrlNoPublic http(s) link to a JSON array, an object holding one array (like {"data": [...]}) or NDJSON (one object per line), up to 500 MB.
maxRowsNoOptional. Flatten only the first N items, for example to try your settings on a big dataset. Empty = all rows.
maxDepthNoHow many levels deep to flatten. Deeper objects are kept as JSON text in one column. Default 20 (everything, in practice).
datasetIdNoAn Apify dataset with nested items, for example the results of a scraper run. You can paste a dataset ID or URL. Use one source: a dataset, a JSON URL or pasted JSON.
separatorNoJoins nested keys into one column name: . gives address.city, _ gives address_city, __ gives address__city. 1 to 5 characters. Default: a dot..
joinSeparatorNoUsed when Arrays is 'join'. Default: semicolon and space.;

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.5/5.0
Behavior5/5

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

Goes well beyond the readOnlyHint/openWorldHint annotations by disclosing that it runs the Actor ucchiii/flatten-json on the caller's own Apify account, requires APIFY_TOKEN, and incurs that Actor's pay-per-event charges with a pricing link. Those are exactly the auth and cost facts an agent needs before invoking a tool that makes external calls.

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

Conciseness4/5

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

Front-loads the return shape, then sources, then the source constraint and cost/auth disclosure -- a sensible order with no filler sentences. It is dense but each sentence contributes; the 'ready for CSV or a spreadsheet' clause is the only mildly decorative element.

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?

For an 8-parameter tool with no output schema, the description covers output shape, accepted inputs, the source-selection constraint, and cost/credential implications, so an agent can call it correctly. It is silent on runtime expectations for very large inputs and on error behavior for malformed JSON, which are the remaining gaps.

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 would be 3, but the description adds real meaning on top: it summarizes the configurable axes ('how arrays are written', 'how deep to flatten', 'the key separator') and supplies the at-least-one-of-source constraint the schema omits by declaring no required properties. Format details like the 10,000-item and 500 MB limits are left to the schema.

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?

States a specific verb and resource ('Flattens nested JSON') plus the exact output shape ('Returns one flat item per input item: nested keys become columns like address.city'). The three supported input sources (pasted items, JSON/NDJSON URL, Apify dataset) further pin down what the tool consumes, so an agent knows precisely what it does without opening the schema.

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?

Gives a concrete source-selection rule -- 'Give at least one of: items or jsonUrl or datasetId' -- which is essential since the schema marks nothing required, and the schema's datasetId field reinforces 'Use one source'. It does not name any alternative tool or say when a sibling (e.g. excel_to_json) would be the better pick, so it stops short of full when/when-not guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.