Math & Calculation
calculate
Evaluate mathematical expressions safely.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
expression | string | Yes | Math expression to evaluate |
Supported Functions:
- Basic operators:
+,-,*,/,**,% - Built-in:
abs,round,min,max,sum - Powers & logarithms:
sqrt,pow,exp,log,log10,log2 - Trigonometric:
sin,cos,tan,asin,acos,atan,atan2 - Hyperbolic:
sinh,cosh,tanh - Angular conversion:
degrees,radians - Rounding:
ceil,floor,trunc - Other:
factorial,gcd - Constants:
pi,e,tau,inf
Safety limits: factorial capped at 1,558; exponents capped at magnitude 1,000.
Examples:
sqrt(16) + 2**3 → 12.0
sin(pi/2) → 1.0
log(100, 10) → 2.0
factorial(5) → 120
ceil(3.2) → 4
Date & Time
get_current_datetime
Get current date and time in any timezone.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
timezone | string | No | Timezone name (default: UTC) |
output_format | string | No | Output format (default: %Y-%m-%d %H:%M:%S %Z) |
Examples:
Timezone: America/New_York
Timezone: Europe/London
Timezone: Asia/Tokyo
convert_timezone
Convert datetime between timezones.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
datetime_str | string | Yes | Datetime to convert |
from_timezone | string | Yes | Source timezone |
to_timezone | string | Yes | Target timezone |
output_format | string | No | Output format (strftime format string, default: “%Y-%m-%d %H:%M:%S %Z”) |
parse_date
Parse date strings in various formats.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
date_str | string | Yes | Date string to parse |
output_format | string | No | Output format (strftime format string, default: “%Y-%m-%d %H:%M:%S”) |
Supported Formats:
2024-12-25December 25, 202425/12/202412-25-2024
Text Processing
word_count
Count words, characters, lines, and sentences.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
text | string | Yes | Text to analyze |
Returns:
{
"words": 150,
"characters": 823,
"lines": 12,
"sentences": 8
}
find_replace
Find and replace text with regex support.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
text | string | Yes | Input text |
find | string | Yes | Pattern to find |
replace | string | Yes | Replacement text |
use_regex | bool | No | Use regex (default: false) |
case_sensitive | bool | No | Case sensitive (default: true) |
extract_urls
Extract all URLs from text.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
text | string | Yes | Text to extract URLs from |
Returns: List of URLs found
extract_emails
Extract all email addresses from text.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
text | string | Yes | Text to extract emails from |
Returns: List of email addresses found
text_compare
Compare two texts and show differences.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
text1 | string | Yes | First text |
text2 | string | Yes | Second text |
Returns: Diff output showing additions and deletions
split_text
Split text by delimiter.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
text | string | Yes | Text to split |
delimiter | string | No | Delimiter (default: newline) |
max_parts | int | No | Maximum number of parts to split into |
trim_text
Trim text to maximum length.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
text | string | Yes | Text to trim |
max_length | int | Yes | Maximum length |
add_ellipsis | bool | No | Whether to add ’…’ when truncated (default: true) |
JSON Processing
parse_json
Parse and validate JSON strings.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
json_str | string | Yes | JSON string to parse |
Returns: Parsed object or validation error
format_json
Pretty-print JSON with indentation.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
json_str | string | Yes | JSON to format |
indent | int | No | Indentation level (default: 2) |
query_json
Query JSON using path expressions.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
json_str | string | Yes | JSON to query |
path | string | Yes | Query path (e.g., data.users[0].name) |
Path Syntax:
data.users → Access 'users' in 'data'
data.users[0] → First element of array
data.users[-1] → Last element of array
data.users[*].name → All 'name' fields in array
extract_json
Extract JSON from mixed text content.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
text | string | Yes | Text containing JSON |
Returns: Extracted JSON object(s)
json_to_text
Convert JSON to human-readable text.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
json_str | string | Yes | JSON to convert |
NLP Tools
analyze_sentiment
Analyze text sentiment.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
text | string | Yes | Text to analyze |
Returns:
{
"sentiment": "positive",
"polarity": 0.75,
"subjectivity": 0.6
}
- polarity: -1.0 (negative) to 1.0 (positive)
- subjectivity: 0.0 (objective) to 1.0 (subjective)
summarize_text
Summarize long text by extracting important sentences.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
text | string | Yes | Text to summarize |
num_sentences | int | No | Number of sentences (default: 3) |
extract_keywords
Extract the most important keywords from text.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
text | string | Yes | Text to analyze |
num_keywords | int | No | Number of keywords (default: 10) |