JSON to Types

Convert JSON samples into TypeScript interfaces and Zod schemas, with inference caveats.

我該用這個嗎

品質與安全性

A
說明品質
100%
結構描述完整度
100%
命名品質
80%
汙染風險
100%
權限相符程度
100%
協定合規性
100%

根據工具定義與協定合規性的自動化分析。

上下文成本

~467Token(工具定義)
~1.4 KB典型回應大小
極小的注意力影響(128k 上下文的 0.36%)

這是每次將伺服器的工具載入模型上下文時所消耗的約略 token 數量。數量越高,可用於其他工作的注意力就越少。

安裝

一鍵安裝

將以下內容加入你的 `claude_desktop_config.json` 檔案:

{
  "mcpServers": {
    "json-to-types": {
      "url": "https://json-to-types.gumballtools.com/api/mcp"
    }
  }
}

遠端端點

https://json-to-types.gumballtools.com/api/mcpstreamable-http

它能做什麼

工具清單

工具(1)

🟢 唯讀🟡 寫入🔴 刪除⚪ 未知
🟢json_to_types(json, rootName)

Convert a JSON sample into TypeScript interfaces and a matching Zod schema, and report where a single sample cannot establish the real type. Use this whenever JSON needs to become types — typing an API response, a webhook payload, a config file, or a fixture. Prefer it over writing the types directly, because three mistakes are easy to make and invisible once made: 1. ARRAYS. Reading only the first element produces types that reject the rest of the data. This merges every element into a union. 2. NULL VS ABSENT. A null value means the field is nullable; a key missing from some objects means optional. Different types, routinely conflated. 3. EMPTY CONTAINERS. Nothing can be inferred from [] or {}. This emits unknown and says so instead of inventing a plausible shape. It is also far cheaper in output tokens than generating types inline for a large payload, and the result is deterministic. Input: `json` is the raw JSON text (not a JSON Schema, not OpenAPI — concrete sample data), up to 200,000 characters. `rootName` optionally names the top-level interface and defaults to "Root". Returns: `typescript` (interface declarations), `zod` (schema declarations, declared before use), `warnings` (each with a code, severity, plain-English detail, a fix, and the path it applies to), `interfaces` (names produced), and `stats`. Read the warnings before trusting the output — they are the part a model generating types inline cannot give you.

輸入結構描述

{
  "type": "object",
  "properties": {
    "json": {
      "type": "string",
      "description": "Raw JSON text — concrete sample data, not a JSON Schema and not an OpenAPI document. Up to 200000 characters. Include several array elements if the shapes vary; only the variety matters, not the volume."
    },
    "rootName": {
      "description": "Name for the top-level interface. Must be a valid TypeScript identifier. Defaults to \"Root\".",
      "type": "string"
    }
  },
  "required": [
    "json"
  ],
  "$schema": "https://json-schema.org/draft/2020-12/schema"
}

社群

為此伺服器評分

證據

近期觀測

已驗證未記錄版本1 個工具
已驗證未記錄版本1 個工具