import type { ToolDefinition } from '@conveniencepro/ctp-core';
export const jsonFormatterDefinition: ToolDefinition = {
// Required fields
id: 'json-formatter',
name: 'JSON Formatter',
description: 'Format, validate, and beautify JSON data with customizable indentation.',
category: 'formatters',
tags: ['json', 'format', 'beautify', 'validate', 'minify'],
method: 'POST',
parameters: [
{
name: 'json',
type: 'textarea',
label: 'JSON Input',
description: 'The JSON string to format',
required: true,
placeholder: '{"name": "example"}',
validation: { minLength: 1, maxLength: 1000000 },
},
{
name: 'indent',
type: 'select',
label: 'Indentation',
description: 'Number of spaces for indentation',
required: false,
defaultValue: '2',
options: [
{ value: '0', label: 'Minified' },
{ value: '2', label: '2 spaces' },
{ value: '4', label: '4 spaces' },
{ value: 'tab', label: 'Tab' },
],
},
{
name: 'sortKeys',
type: 'boolean',
label: 'Sort Keys',
description: 'Sort object keys alphabetically',
required: false,
defaultValue: false,
},
],
outputDescription: 'Formatted JSON string',
example: {
input: { json: '{"b":2,"a":1}', indent: '2', sortKeys: true },
output: {
formatted: '{\n "a": 1,\n "b": 2\n}',
valid: true,
lineCount: 4,
},
},
// Optional fields
version: '1.0.0',
icon: '📋',
keywords: ['pretty print', 'beautifier'],
relatedTools: ['json-validator', 'json-minifier'],
aiInstructions: 'Use 2-space indentation by default. Enable sortKeys for consistent output.',
executionMode: 'client',
};