Development
Преобразует спецификации OpenAPI или Swagger в формате JSON/YAML в типы TypeScript, параметры запросов и модели ответов с настраиваемым форматом вывода и стилем имен
Вызовите этот инструмент из своего кода на трёх языках.
curl -X POST 'https://api.elysiatools.com/ru/api/tools/openapi-to-typescript-generator' \
-H 'Content-Type: application/json' \
-d '{"specInput":"openapi: 3.0.0\ninfo:\n title: User API\n version: 1.0.0\npaths:\n /users/{id}:\n get:\n operationId: getUser\n parameters:\n - in: path\n name: id\n required: true\n schema:\n type: string\n responses:\n \"200\":\n description: ok\n content:\n application/json:\n schema:\n $ref: \"#/components/schemas/User\"\ncomponents:\n schemas:\n User:\n type: object\n required: [id, name]\n properties:\n id:\n type: string\n name:\n type: string","sourceFormat":"yaml","outputFormat":"flat","namingStyle":"pascal","declarationStyle":"interface","namespaceName":"Api","includeOperationTypes":true,"includeDescriptions":true}'Отправьте POST-запрос с входными данными в JSON. Параметры типа «файл» требуют предварительной загрузки.
POST https://api.elysiatools.com/ru/api/tools/openapi-to-typescript-generator| Имя | Тип | Обязательный | Описание |
|---|---|---|---|
| specInput | textarea | Да | — |
| sourceFormat | select | Нет | — |
| outputFormat | select | Нет | — |
| namingStyle | select | Нет | — |
| declarationStyle | select | Нет | — |
| namespaceName | text | Нет | — |
| includeOperationTypes | checkbox | Нет | — |
| includeDescriptions | checkbox | Нет | — |
Текстовый результат
{
"result": "Processed text content",
"error": "Error message (optional)",
"message": "Notification message (optional)",
"metadata": {
"key": "value"
}
}Добавьте этот инструмент на свой сервер Model Context Protocol, чтобы ИИ-агенты могли перечислять и вызывать его.
Добавьте этот блок в конфигурацию вашего MCP-клиента:
{
"mcpServers": {
"elysiatools-openapi-to-typescript-generator": {
"name": "openapi-to-typescript-generator",
"description": "Преобразует спецификации OpenAPI или Swagger в формате JSON/YAML в типы TypeScript, параметры запросов и модели ответов с настраиваемым форматом вывода и стилем имен",
"baseUrl": "https://api.elysiatools.com/mcp/sse?toolId=openapi-to-typescript-generator",
"command": "",
"args": [],
"env": {},
"isActive": true,
"type": "sse"
}
}
}После подключения к SSE-endpoint выведите список доступных инструментов:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/list"
}Вызовите инструмент по его id; аргументы формируются из его параметров:
{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "openapi-to-typescript-generator",
"arguments": {
"specInput": "openapi: 3.0.0\ninfo:\n title: User API\n version: 1.0.0\npaths:\n /users/{id}:\n get:\n operationId: getUser\n parameters:\n - in: path\n name: id\n required: true\n schema:\n type: string\n responses:\n \"200\":\n description: ok\n content:\n application/json:\n schema:\n $ref: \"#/components/schemas/User\"\ncomponents:\n schemas:\n User:\n type: object\n required: [id, name]\n properties:\n id:\n type: string\n name:\n type: string",
"sourceFormat": "yaml",
"outputFormat": "flat",
"namingStyle": "pascal",
"declarationStyle": "interface",
"namespaceName": "Api",
"includeOperationTypes": true,
"includeDescriptions": true
}
}
}Вопросы или проблемы? Свяжитесь с [email protected]