Files
app-write-mcp/removed-tools-backup.ts
2025-09-05 03:44:25 +03:00

409 lines
11 KiB
TypeScript

/**
* REMOVED TOOLS BACKUP
*
* This file contains all the tools that were removed from the main MCP server
* to reduce context usage. These tools can be restored if needed in the future.
*
* Removed on: 2025-09-05
* Reason: Reduce MCP context usage from ~61,830 tokens to under 25,000 tokens
*
* Categories of removed tools:
* 1. Data Analysis & Intelligence Tools (8 tools)
* 2. Avatars Service (7 tools)
* 3. Locale Service (5 tools)
* 4. Advanced User Management (12 tools)
* 5. Messaging Targets (5 tools)
* 6. Health Monitoring (2 tools) - kept get_health only
* 7. Session Management (3 tools)
* 8. Function Execution (1 tool)
*
* Total removed: ~43 tools
*/
// ===== DATA ANALYSIS & INTELLIGENCE TOOLS (8 tools) =====
// auto_detect_schema - Smart analysis feature
const autoDetectSchemaTool = {
name: "auto_detect_schema",
description: "Analyze sample data and automatically create collection schema with appropriate attributes",
inputSchema: {
type: "object",
properties: {
databaseId: { type: "string", description: "ID of the database" },
collectionName: { type: "string", description: "Name for the new collection" },
collectionId: { type: "string", description: "Custom collection ID (optional)" },
sampleData: {
type: "array",
items: { type: "object" },
description: "Array of sample documents to analyze"
}
},
required: ["databaseId", "collectionName", "sampleData"]
}
};
// suggest_indexes - Analysis recommendation
const suggestIndexesTool = {
name: "suggest_indexes",
description: "Analyze collection usage patterns and recommend optimal indexes",
inputSchema: {
type: "object",
properties: {
databaseId: { type: "string", description: "ID of the database" },
collectionId: { type: "string", description: "ID of the collection" },
queryPatterns: {
type: "array",
items: { type: "string" },
description: "Common query patterns (optional)"
}
},
required: ["databaseId", "collectionId"]
}
};
// validate_document - Pre-validation
const validateDocumentTool = {
name: "validate_document",
description: "Validate document data against collection schema before creation",
inputSchema: {
type: "object",
properties: {
databaseId: { type: "string", description: "ID of the database" },
collectionId: { type: "string", description: "ID of the collection" },
documentData: { type: "object", description: "Document data to validate" }
},
required: ["databaseId", "collectionId", "documentData"]
}
};
// schema_migration - Advanced schema operation
const schemaMigrationTool = {
name: "schema_migration",
description: "Automatically migrate collection schema with data preservation",
inputSchema: {
type: "object",
properties: {
databaseId: { type: "string", description: "ID of the database" },
collectionId: { type: "string", description: "ID of the collection" },
newSchema: {
type: "array",
items: { type: "object" },
description: "New schema definition"
},
migrationStrategy: {
type: "string",
enum: ["safe", "aggressive"],
description: "Migration strategy (safe, aggressive)",
default: "safe"
}
},
required: ["databaseId", "collectionId", "newSchema"]
}
};
// analyze_collection - Data insights analysis
const analyzeCollectionTool = {
name: "analyze_collection",
description: "Get comprehensive data insights and patterns from a collection",
inputSchema: {
type: "object",
properties: {
databaseId: { type: "string", description: "ID of the database" },
collectionId: { type: "string", description: "ID of the collection" },
analysisType: {
type: "string",
enum: ["basic", "detailed", "statistical"],
description: "Type of analysis",
default: "basic"
}
},
required: ["databaseId", "collectionId"]
}
};
// detect_duplicates - Data analysis feature
const detectDuplicatesTool = {
name: "detect_duplicates",
description: "Find potential duplicate records across collections",
inputSchema: {
type: "object",
properties: {
databaseId: { type: "string", description: "ID of the database" },
collectionId: { type: "string", description: "ID of the collection" },
fields: {
type: "array",
items: { type: "string" },
description: "Fields to check for duplicates"
},
threshold: {
type: "number",
description: "Similarity threshold (0-1)",
default: 0.9
}
},
required: ["databaseId", "collectionId", "fields"]
}
};
// data_quality_check - Quality analysis
const dataQualityCheckTool = {
name: "data_quality_check",
description: "Analyze data quality and identify issues (missing fields, invalid formats, etc.)",
inputSchema: {
type: "object",
properties: {
databaseId: { type: "string", description: "ID of the database" },
collectionId: { type: "string", description: "ID of the collection" },
checkType: {
type: "string",
enum: ["completeness", "validity", "consistency", "all"],
description: "Type of quality check",
default: "all"
}
},
required: ["databaseId", "collectionId"]
}
};
// usage_stats - Analytics feature
const usageStatsTool = {
name: "usage_stats",
description: "Get usage statistics and access patterns for collections and documents",
inputSchema: {
type: "object",
properties: {
databaseId: { type: "string", description: "ID of the database" },
collectionId: { type: "string", description: "ID of the collection (optional, for all collections if not specified)" },
timeRange: {
type: "string",
enum: ["1d", "7d", "30d", "90d"],
description: "Time range for stats",
default: "7d"
}
},
required: ["databaseId"]
}
};
// ===== AVATARS SERVICE (7 tools) =====
const avatarTools = [
{
name: "get_browser_icon",
description: "Get browser icon image URL",
inputSchema: {
type: "object",
properties: {
code: { type: "string", description: "Browser code" },
width: { type: "number", description: "Icon width (optional)" },
height: { type: "number", description: "Icon height (optional)" },
quality: { type: "number", description: "Image quality (optional)" }
},
required: ["code"]
}
},
{
name: "get_credit_card_icon",
description: "Get credit card icon image URL",
inputSchema: {
type: "object",
properties: {
code: { type: "string", description: "Credit card code" },
width: { type: "number", description: "Icon width (optional)" },
height: { type: "number", description: "Icon height (optional)" },
quality: { type: "number", description: "Image quality (optional)" }
},
required: ["code"]
}
},
{
name: "get_favicon",
description: "Get website favicon URL",
inputSchema: {
type: "object",
properties: {
url: { type: "string", description: "Website URL" }
},
required: ["url"]
}
},
{
name: "get_flag_icon",
description: "Get country flag icon URL",
inputSchema: {
type: "object",
properties: {
code: { type: "string", description: "Country code" },
width: { type: "number", description: "Icon width (optional)" },
height: { type: "number", description: "Icon height (optional)" },
quality: { type: "number", description: "Image quality (optional)" }
},
required: ["code"]
}
},
{
name: "get_image_from_url",
description: "Get image from URL with transformations",
inputSchema: {
type: "object",
properties: {
url: { type: "string", description: "Image URL" },
width: { type: "number", description: "Image width (optional)" },
height: { type: "number", description: "Image height (optional)" }
},
required: ["url"]
}
},
{
name: "get_initials_avatar",
description: "Generate initials avatar URL",
inputSchema: {
type: "object",
properties: {
name: { type: "string", description: "Name for initials" },
width: { type: "number", description: "Avatar width (optional)" },
height: { type: "number", description: "Avatar height (optional)" },
background: { type: "string", description: "Background color (optional)" }
},
required: ["name"]
}
},
{
name: "get_qr_code",
description: "Generate QR code URL",
inputSchema: {
type: "object",
properties: {
text: { type: "string", description: "Text to encode" },
size: { type: "number", description: "QR code size (optional)" },
margin: { type: "number", description: "QR code margin (optional)" },
download: { type: "boolean", description: "Force download (optional)" }
},
required: ["text"]
}
}
];
// ===== LOCALE SERVICE (5 tools) =====
const localeTools = [
{
name: "list_countries",
description: "List all countries with phone codes"
},
{
name: "list_continents",
description: "List all continents"
},
{
name: "list_currencies",
description: "List all currencies"
},
{
name: "list_languages",
description: "List all languages"
},
{
name: "list_phone_codes",
description: "List phone codes for all countries"
}
];
// ===== ADVANCED USER MANAGEMENT (12 tools) =====
const advancedUserTools = [
"verify_user_email",
"unverify_user_email",
"verify_user_phone",
"unverify_user_phone",
"update_user_mfa",
"create_user_mfa_recovery_codes",
"update_user_phone_verification",
"update_user_password_hash",
"list_user_identities",
"delete_user_identity",
"update_user_labels",
"get_user_preferences"
];
// ===== MESSAGING TARGETS (5 tools) =====
const messagingTargetTools = [
"create_user_target",
"list_user_targets",
"get_user_target",
"update_user_target",
"delete_user_target"
];
// ===== HEALTH MONITORING (2 tools - kept get_health only) =====
const healthTools = [
"get_health_db",
"get_health_storage"
];
// ===== SESSION MANAGEMENT (3 tools) =====
const sessionTools = [
"create_session",
"delete_session",
"list_sessions"
];
// ===== FUNCTION EXECUTION (1 tool) =====
const functionExecutionTools = [
"execute_function"
];
/**
* TOOL IMPLEMENTATIONS
*
* The actual implementation code for these tools was removed from the main file.
* If you need to restore any of these tools:
*
* 1. Add the tool definition back to the tools list in setupToolHandlers()
* 2. Add the case handler back to the handleTool() switch statement
* 3. Restore the implementation method to the class
*
* The implementations used the standard pattern:
* - Validate configuration
* - Parse input parameters
* - Call appropriate Appwrite service method
* - Return formatted response
* - Handle errors gracefully
*/
export {
// Data Analysis Tools
autoDetectSchemaTool,
suggestIndexesTool,
validateDocumentTool,
schemaMigrationTool,
analyzeCollectionTool,
detectDuplicatesTool,
dataQualityCheckTool,
usageStatsTool,
// Avatar Tools
avatarTools,
// Locale Tools
localeTools,
// Advanced User Tools
advancedUserTools,
// Messaging Target Tools
messagingTargetTools,
// Health Tools
healthTools,
// Session Tools
sessionTools,
// Function Execution Tools
functionExecutionTools
};