# derive_graph

> Infer a data-free recipe (entity types, relationships) from a real sample file. Pass the file as base64. Use before generating relationship-preserving…

Section: MCP · Type: tool · Last updated: 2026-09-13

Infer a data-free recipe (entity types, relationships) from a real sample file. Pass the file as base64. Use before generating relationship-preserving synthetic data.

## The picture

Agent (calls) → derive_graph (Draft a recipe) → Result (as data)

## Inputs

- file_base64 (string, required) — see the input schema
- format (string) — see the input schema

## When to call it

Infers structure from a real file and returns a recipe carrying no values. That is the point: you can hand the result to someone who is not allowed to see the original data.

Pass the file base64-encoded. Supported formats: csv, xlsx, json, xml.

## Example request

```json
{
  "_comment": "A two-row CSV, base64-encoded.",
  "name": "derive_graph",
  "arguments": {
    "file_base64": "Y3VzdG9tZXJfaWQsbmFtZSxlbWFpbCxhbW91bnQKMSxBZGEgTG92ZWxhY2UsYWRhQGV4YW1wbGUudGVzdCwxMjAuNTAKMixBbGFuIFR1cmluZyxhbGFuQGV4YW1wbGUudGVzdCw5OS4wMAo=",
    "format": "csv"
  }
}
```

A string argument that holds JSON is shown unescaped here; send it as a string.

## Example response

```json
{
  "contract_version": 3,
  "$schema": "https://theworklens.com/schema/recipe/v1.json",
  "version": 1,
  "project": "derived",
  "entities": [
    {
      "name": "Record",
      "rows": 2,
      "fields": [
        {
          "name": "customer_id",
          "type": "id",
          "sensitivity": "linked",
          "generate": "fake",
          "unique": true
        },
        {
          "name": "name",
          "type": "person.fullName",
          "sensitivity": "pii",
          "generate": "fake"
        },
        {
          "name": "email",
          "type": "internet.email",
          "sensitivity": "pii",
          "generate": "fake"
        },
        {
          "name": "amount",
          "type": "float",
          "sensitivity": "safe",
          "generate": "keep"
        }
      ]
    }
  ],
  "relationships": [],
  "output": {
    "format": "csv"
  },
  "scenarios": [
    {
      "name": "happy"
    },
    {
      "name": "nulls",
      "null_rate": 0.15
    },
    {
      "name": "boundary",
      "mode": "boundary"
    }
  ]
}
```

## Same step

- [get_recipe_schema](https://theworklens.com/docs/mcp/tools/get-recipe-schema): The recipe (GraphModel) authoring guide: JSON shape, every engine field type, FK conventions, rules and a working example. Call this FIRST, WITH A plan of what you are about to build (output csv or fixed, the constructs you expect, region, whether you are reading a repository): the reply then carries exactly what…
- [analyse_openapi](https://theworklens.com/docs/mcp/tools/analyse-openapi): Analyse an OpenAPI 3.x / Swagger 2.0 spec (JSON string) and preview what a WorkLens import would produce: object entities with field counts and ref lists, inlined value-types, and cross-entity foreign keys. Use before recommending an import. Standalone entities are marked defaultSelected:false so a checklist can…
- [Tool directory](https://theworklens.com/docs/mcp/tools): All 13 tools, grouped by step.

## Related

- [Tool directory](https://theworklens.com/docs/mcp/tools): All 13 tools the WorkLens MCP server exposes, grouped by the step they belong to, generated from the published contracts.
- [get_recipe_schema](https://theworklens.com/docs/mcp/tools/get-recipe-schema): The recipe (GraphModel) authoring guide: JSON shape, every engine field type, FK conventions, rules and a working example. Call this FIRST, WITH A plan of…
- [analyse_openapi](https://theworklens.com/docs/mcp/tools/analyse-openapi): Analyse an OpenAPI 3.x / Swagger 2.0 spec (JSON string) and preview what a WorkLens import would produce: object entities with field counts and ref lists,…

_← Previous: [get_recipe_schema](https://theworklens.com/docs/mcp/tools/get-recipe-schema) · Next: [analyse_openapi](https://theworklens.com/docs/mcp/tools/analyse-openapi) →_

_README, input schema and the primary worked request and response for this tool, published with the server. Source: mcp-schemas/tools/02-derive_graph._

_Canonical: https://theworklens.com/docs/mcp/tools/derive-graph · This copy: https://theworklens.com/docs/mcp/tools/derive-graph.md_
