Skip to main content
Glama
leeguooooo
by leeguooooo
tool_schemas.py23 kB
""" MCP tool schemas definitions """ # Email tools schemas LIST_EMAILS_SCHEMA = { "type": "object", "properties": { "limit": { "type": "integer", "description": "Maximum number of emails to return (default: 50)", "default": 100 }, "offset": { "type": "integer", "description": "Number of emails to skip for pagination (default: 0)", "default": 0 }, "unread_only": { "type": "boolean", "description": "Only return unread emails (default: true)", "default": True }, "folder": { "type": "string", "description": "Email folder to fetch from (default: 'all' = no folder filter when using cache; falls back to INBOX for live IMAP)", "default": "all" }, "account_id": { "type": "string", "description": "Specific account to fetch from (optional)" }, "include_metadata": { "type": "boolean", "description": "Include source metadata (cache/fetch) in results (default: true)", "default": True }, "use_cache": { "type": "boolean", "description": "Use local sync cache (email_sync.db) instead of live IMAP when available", "default": True } } } GET_EMAIL_DETAIL_SCHEMA = { "type": "object", "required": ["email_id"], "properties": { "email_id": { "type": "string", "description": "The ID of the email to retrieve" }, "folder": { "type": "string", "description": "Email folder (default: 'INBOX')", "default": "INBOX" }, "account_id": { "type": "string", "description": "Specific account ID (optional)" } } } MARK_EMAILS_SCHEMA = { "type": "object", "required": ["email_ids", "mark_as"], "properties": { "email_ids": { "type": "array", "items": {"type": "string"}, "description": "List of email IDs to mark" }, "mark_as": { "type": "string", "enum": ["read", "unread"], "description": "Mark emails as 'read' or 'unread'" }, "folder": { "type": "string", "description": "Email folder (default: 'INBOX')", "default": "INBOX" }, "account_id": { "type": "string", "description": "Specific account ID (recommended; required when not using email_accounts)" }, "dry_run": { "type": "boolean", "description": "If true, only validate without executing (default: false)", "default": False }, "email_accounts": { "type": "array", "description": "Optional per-email account mapping for multi-account operations", "items": { "type": "object", "required": ["email_id", "account_id"], "properties": { "email_id": { "type": "string", "description": "Email ID to operate on" }, "account_id": { "type": "string", "description": "Account ID that owns this email" }, "folder": { "type": "string", "description": "Override folder for this email (optional)" } } } } } } MARK_EMAIL_READ_SCHEMA = { "type": "object", "required": ["email_id"], "properties": { "email_id": { "type": "string", "description": "Email ID to mark as read" }, "folder": { "type": "string", "description": "Email folder (default: 'INBOX')", "default": "INBOX" }, "account_id": { "type": "string", "description": "Specific account ID (optional)" } } } MARK_EMAIL_UNREAD_SCHEMA = { "type": "object", "required": ["email_id"], "properties": { "email_id": { "type": "string", "description": "Email ID to mark as unread" }, "folder": { "type": "string", "description": "Email folder (default: 'INBOX')", "default": "INBOX" }, "account_id": { "type": "string", "description": "Specific account ID (optional)" } } } BATCH_MARK_READ_SCHEMA = { "type": "object", "required": ["email_ids"], "properties": { "email_ids": { "type": "array", "items": {"type": "string"}, "description": "List of email IDs to mark as read" }, "folder": { "type": "string", "description": "Email folder (default: 'INBOX')", "default": "INBOX" }, "account_id": { "type": "string", "description": "Specific account ID (required for safety)" } } } DELETE_EMAIL_SCHEMA = { "type": "object", "required": ["email_id"], "properties": { "email_id": { "type": "string", "description": "Email ID to delete" }, "folder": { "type": "string", "description": "Source folder (default: 'INBOX')", "default": "INBOX" }, "permanent": { "type": "boolean", "description": "Permanently delete instead of moving to trash", "default": False }, "trash_folder": { "type": "string", "description": "Trash folder name (default: 'Trash')", "default": "Trash" }, "account_id": { "type": "string", "description": "Specific account ID (optional)" } } } DELETE_EMAILS_SCHEMA = { "type": "object", "required": ["email_ids"], "properties": { "email_ids": { "type": "array", "items": {"type": "string"}, "description": "List of email IDs to delete" }, "folder": { "type": "string", "description": "Source folder (default: 'INBOX')", "default": "INBOX" }, "permanent": { "type": "boolean", "description": "Permanently delete instead of moving to trash", "default": False }, "trash_folder": { "type": "string", "description": "Trash folder name (default: 'Trash')", "default": "Trash" }, "account_id": { "type": "string", "description": "Specific account ID (recommended; required when not using email_accounts)" }, "dry_run": { "type": "boolean", "description": "If true, only validate without executing (default: false)", "default": False }, "email_accounts": { "type": "array", "description": "Optional per-email account mapping for multi-account operations", "items": { "type": "object", "required": ["email_id", "account_id"], "properties": { "email_id": { "type": "string", "description": "Email ID to operate on" }, "account_id": { "type": "string", "description": "Account ID that owns this email" }, "folder": { "type": "string", "description": "Override folder for this email (optional)" } } } } } } BATCH_DELETE_EMAILS_SCHEMA = { "type": "object", "required": ["email_ids"], "properties": { "email_ids": { "type": "array", "items": {"type": "string"}, "description": "List of email IDs to delete" }, "folder": { "type": "string", "description": "Source folder (default: 'INBOX')", "default": "INBOX" }, "permanent": { "type": "boolean", "description": "Permanently delete instead of moving to trash", "default": False }, "trash_folder": { "type": "string", "description": "Trash folder name (default: 'Trash')", "default": "Trash" }, "account_id": { "type": "string", "description": "Specific account ID (recommended)" }, "dry_run": { "type": "boolean", "description": "If true, only validate without executing (default: false)", "default": False } } } SEARCH_EMAILS_SCHEMA = { "type": "object", "properties": { "query": { "type": "string", "description": "Search query text" }, "search_in": { "type": "string", "enum": ["subject", "from", "body", "to", "all"], "description": "Where to search (default: 'all')", "default": "all" }, "date_from": { "type": "string", "description": "Start date (YYYY-MM-DD format)" }, "date_to": { "type": "string", "description": "End date (YYYY-MM-DD format)" }, "folder": { "type": "string", "description": "Folder to search in (default: 'all' for all folders)", "default": "all" }, "unread_only": { "type": "boolean", "description": "Only search unread emails", "default": False }, "has_attachments": { "type": "boolean", "description": "Filter by attachment presence" }, "limit": { "type": "integer", "description": "Maximum results (default: 50)", "default": 50 }, "offset": { "type": "integer", "description": "Number of results to skip for pagination (default: 0)", "default": 0 }, "account_id": { "type": "string", "description": "Search specific account only" } } } SEND_EMAIL_SCHEMA = { "type": "object", "required": ["to", "subject", "body"], "properties": { "to": { "type": "array", "items": {"type": "string"}, "description": "Recipient email addresses" }, "subject": { "type": "string", "description": "Email subject" }, "body": { "type": "string", "description": "Email body content" }, "cc": { "type": "array", "items": {"type": "string"}, "description": "CC recipients" }, "bcc": { "type": "array", "items": {"type": "string"}, "description": "BCC recipients" }, "attachments": { "type": "array", "items": { "type": "object", "required": ["filename", "content"], "properties": { "filename": {"type": "string"}, "content": {"type": "string", "description": "Base64 encoded content"} } }, "description": "File attachments" }, "is_html": { "type": "boolean", "description": "Whether body is HTML", "default": False }, "account_id": { "type": "string", "description": "Send from specific account" } } } REPLY_EMAIL_SCHEMA = { "type": "object", "required": ["email_id", "body"], "properties": { "email_id": { "type": "string", "description": "ID of email to reply to" }, "body": { "type": "string", "description": "Reply body content" }, "reply_all": { "type": "boolean", "description": "Reply to all recipients", "default": False }, "folder": { "type": "string", "description": "Folder containing original email", "default": "INBOX" }, "attachments": { "type": "array", "items": { "type": "object", "required": ["filename", "content"], "properties": { "filename": {"type": "string"}, "content": {"type": "string", "description": "Base64 encoded content"} } } }, "is_html": { "type": "boolean", "description": "Whether body is HTML", "default": False }, "account_id": { "type": "string", "description": "Reply from specific account" } } } FORWARD_EMAIL_SCHEMA = { "type": "object", "required": ["email_id", "to"], "properties": { "email_id": { "type": "string", "description": "ID of email to forward" }, "to": { "type": "array", "items": {"type": "string"}, "description": "Recipients to forward to" }, "body": { "type": "string", "description": "Additional message (optional)" }, "folder": { "type": "string", "description": "Folder containing original email", "default": "INBOX" }, "include_attachments": { "type": "boolean", "description": "Include original attachments", "default": True }, "account_id": { "type": "string", "description": "Forward from specific account" } } } LIST_FOLDERS_SCHEMA = { "type": "object", "properties": { "account_id": { "type": "string", "description": "List folders for specific account" } } } MOVE_EMAILS_TO_FOLDER_SCHEMA = { "type": "object", "required": ["email_ids", "target_folder"], "properties": { "email_ids": { "type": "array", "items": {"type": "string"}, "description": "Email IDs to move" }, "target_folder": { "type": "string", "description": "Target folder name" }, "source_folder": { "type": "string", "description": "Source folder (default: 'INBOX')", "default": "INBOX" }, "account_id": { "type": "string", "description": "Specific account ID (required for safety)" } } } FLAG_EMAIL_SCHEMA = { "type": "object", "required": ["email_id", "flag_type"], "properties": { "email_id": { "type": "string", "description": "Email ID to flag/unflag" }, "flag_type": { "type": "string", "enum": ["flagged", "important", "answered"], "description": "Flag category to apply" }, "set_flag": { "type": "boolean", "description": "Set to true to add the flag or false to remove it", "default": True }, "folder": { "type": "string", "description": "Email folder", "default": "INBOX" }, "account_id": { "type": "string", "description": "Specific account ID" } } } GET_EMAIL_ATTACHMENTS_SCHEMA = { "type": "object", "required": ["email_id"], "properties": { "email_id": { "type": "string", "description": "Email ID to get attachments from" }, "folder": { "type": "string", "description": "Email folder", "default": "INBOX" }, "account_id": { "type": "string", "description": "Specific account ID" } } } CHECK_CONNECTION_SCHEMA = { "type": "object", "properties": {} } LIST_ACCOUNTS_SCHEMA = { "type": "object", "properties": {} } # Unified sync tool schema SYNC_EMAILS_SCHEMA = { "type": "object", "properties": { "action": { "type": "string", "enum": ["start", "stop", "force", "status", "search", "recent", "config"], "description": "Action to perform: start/stop scheduler, force sync, get status, search cached emails, get recent emails, or manage config" }, "full_sync": { "type": "boolean", "description": "For 'force' action: perform full sync instead of incremental", "default": False }, "account_id": { "type": "string", "description": "For 'force', 'search', 'recent': target specific account only (optional)" }, "query": { "type": "string", "description": "For 'search' action: search query keywords" }, "limit": { "type": "integer", "description": "For 'search', 'recent' actions: maximum number of results", "default": 20 }, "config_updates": { "type": "object", "description": "For 'config' action: configuration updates", "properties": { "interval_minutes": { "type": "integer", "description": "Sync interval in minutes (1-1440)", "minimum": 1, "maximum": 1440 }, "full_sync_hours": { "type": "integer", "description": "Full sync interval in hours (1-168)", "minimum": 1, "maximum": 168 }, "enabled": { "type": "boolean", "description": "Enable or disable sync" }, "max_concurrent_accounts": { "type": "integer", "description": "Maximum concurrent accounts (1-10)", "minimum": 1, "maximum": 10 }, "cleanup_days": { "type": "integer", "description": "Days to keep emails (1-3650)", "minimum": 1, "maximum": 3650 } } } } } # Sync Health Monitoring schemas GET_SYNC_HEALTH_SCHEMA = { "type": "object", "properties": { "account_id": { "type": "string", "description": "Get health for specific account (optional)" } } } GET_CONNECTION_POOL_STATS_SCHEMA = { "type": "object", "properties": {} } GET_SYNC_HISTORY_SCHEMA = { "type": "object", "properties": { "account_id": { "type": "string", "description": "Filter by account ID (optional)" }, "hours": { "type": "integer", "description": "Number of hours to look back (default: 24)", "default": 24, "minimum": 1, "maximum": 168 } } } # Contact Analysis schemas ANALYZE_CONTACTS_SCHEMA = { "type": "object", "properties": { "account_id": { "type": "string", "description": "Account ID to analyze (optional, default: all accounts)" }, "days": { "type": "integer", "description": "Number of days to analyze (default: 30)", "default": 30, "minimum": 1, "maximum": 365 }, "limit": { "type": "integer", "description": "Top N contacts to return (default: 10)", "default": 10, "minimum": 1, "maximum": 100 }, "group_by": { "type": "string", "description": "Group by sender/recipient/both (default: both)", "enum": ["sender", "recipient", "both"], "default": "both" } } } GET_CONTACT_TIMELINE_SCHEMA = { "type": "object", "required": ["contact_email"], "properties": { "contact_email": { "type": "string", "description": "Email address of the contact to analyze" }, "account_id": { "type": "string", "description": "Account ID (optional, default: all accounts)" }, "days": { "type": "integer", "description": "Number of days to look back (default: 90)", "default": 90, "minimum": 1, "maximum": 365 } } } # New atomic tools for granular operations LIST_UNREAD_FOLDERS_SCHEMA = { "type": "object", "properties": { "account_id": { "type": "string", "description": "Get unread counts for specific account (optional, default: all accounts)" }, "include_empty": { "type": "boolean", "description": "Include folders with zero unread emails (default: true)", "default": True } } } GET_EMAIL_HEADERS_SCHEMA = { "type": "object", "required": ["email_id"], "properties": { "email_id": { "type": "string", "description": "Email ID to get headers from" }, "folder": { "type": "string", "description": "Email folder (default: 'INBOX')", "default": "INBOX" }, "account_id": { "type": "string", "description": "Specific account ID (optional)" }, "headers": { "type": "array", "items": {"type": "string"}, "description": "Specific headers to retrieve (optional, default: common headers like From, To, Subject, Date, Message-ID)" } } } GET_RECENT_ACTIVITY_SCHEMA = { "type": "object", "properties": { "account_id": { "type": "string", "description": "Get activity for specific account (optional, default: all accounts)" }, "include_stats": { "type": "boolean", "description": "Include detailed statistics (default: true)", "default": True } } } GET_VERSION_SCHEMA = { "type": "object", "properties": {} }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/leeguooooo/email-mcp-service'

If you have feedback or need assistance with the MCP directory API, please join our Discord server