Overview
- Category
- Developer Tools
- API mode
not_available- Processing
- client-side
- Privacy
- no-data-stored
Public descriptor
The descriptor is available without an API key and supplies this tool’s metadata, schemas, modes, and examples.
GET /api/v1/tools/javascript-formatter
Execute availability
This tool is documented as a browser capability. Its execute route does not produce a server-side result; when execution is enabled, it responds with browser_interaction_required and points callers to the public tool page.
POST /api/v1/tools/javascript-formatter/execute
Authentication is not issued during the preview. A bearer API key is planned for execution after launch.
Input schema
object object; additional properties are not accepted.
javascript· string · required- Enter the javascript source used by this tool.
indent_spaces· number · required- Enter the indentation used by this tool.
space_around_operators· boolean · optional- Enter the space around common operators used by this tool.
{
"type": "object",
"properties": {
"javascript": {
"type": "string",
"description": "Enter the javascript source used by this tool."
},
"indent_spaces": {
"type": "number",
"description": "Enter the indentation used by this tool.",
"minimum": 0,
"maximum": 8
},
"space_around_operators": {
"type": "boolean",
"description": "Enter the space around common operators used by this tool."
}
},
"required": [
"javascript",
"indent_spaces"
],
"additionalProperties": false
}
Output schema
On a successful execution, schema values appear in data.result.values.
formatted_javascript· string- Formatted JavaScript produced by the tool.
line_count· number- Formatted lines produced by the tool.
source_bytes· number- Source bytes produced by the tool.
formatted_bytes· number- Formatted bytes produced by the tool.
{
"type": "object",
"properties": {
"formatted_javascript": {
"type": "string",
"description": "Formatted JavaScript produced by the tool."
},
"line_count": {
"type": "number",
"description": "Formatted lines produced by the tool."
},
"source_bytes": {
"type": "number",
"description": "Source bytes produced by the tool."
},
"formatted_bytes": {
"type": "number",
"description": "Formatted bytes produced by the tool."
}
},
"additionalProperties": false
}
JavaScript Formatter example
The request body follows the published input schema. The response below shows the success-envelope shape returned after execution is available.
curl -X POST "https://utilitypages.org/api/v1/tools/javascript-formatter/execute" \
-H "Content-Type: application/json" \
-d '{
"javascript": "function greet(name){const message=`Hello, ${name}`;return message;}console.log(greet(\"Ada\"));",
"indent_spaces": 2,
"space_around_operators": true
}'
{
"ok": true,
"data": {
"slug": "javascript-formatter",
"result": {
"values": {
"formatted_javascript": "function greet(name) {\n const message = `Hello, ${name}`;\n return message;\n}\nconsole.log(greet(\"Ada\"));",
"line_count": 5,
"source_bytes": 94,
"formatted_bytes": 103
},
"display": {
"display": "function greet(name) {\n const message = `Hello, ${name}`;\n return message;\n}\nconsole.log(greet(\"Ada\"));"
},
"warnings": [],
"assumptions": [],
"steps": []
}
},
"meta": [],
"request_id": "req_example_123"
}
Errors
api_not_launched· 503- Returned by the current launch gate for every execute request.
invalid_json· 400- Returned when an enabled execute request does not contain valid JSON.
validation_failed· 422- Returned when a request does not satisfy the input schema.
browser_interaction_required· 422- Returned for browser capability tools instead of inventing a server-side result.
tool_not_found· 404- Returned when a requested descriptor slug does not exist.
execution_failed· 503- Returned when an enabled server-side execution cannot complete.