-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Description
Summary
Add a format parameter to key tools to enable structured JSON output alongside human-readable text.
Motivation
Current tools return formatted strings - great for display but hard to process programmatically. JSON output enables:
- Chaining tool results
- Integration with other systems
- Custom formatting by consumers
Proposed Changes
Add format: Literal["text", "json"] = "text" to these tools:
get_recent_emailssearch_emailssearch_all_accountsget_inbox_overviewget_unread_count(already returns dict, standardize)list_accounts(already returns list, standardize)
Example
@mcp.tool()
def get_recent_emails(
account: str,
count: int = 10,
format: Literal["text", "json"] = "text"
) -> str | List[Dict]:
"""Get recent emails.
Args:
format: Output format
- "text": Human-readable formatted string (default)
- "json": Structured list of email dictionaries
"""
# ... implementation
if format == "json":
return json.dumps(emails, indent=2)
else:
return format_emails_as_text(emails)JSON Schema for Emails
{
"subject": "string",
"sender": "string",
"date": "ISO8601 string",
"is_read": boolean,
"mailbox": "string",
"account": "string",
"preview": "string (optional)"
}Priority
MEDIUM - Enables programmatic use
Labels
enhancement, priority-medium, api-design
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels