This guide provides detailed examples of building custom tools in Plumi’s MCP Studio. You’ll learn how to create SQL query tools with dynamic parameters and Python tools for advanced data processing.
All tools are built directly in the Plumi UI at app.plumi.ai. Navigate to MCP Studio > Tool Builder to create and manage your tools using the visual editor - no code files or command line required.
A more advanced tool for analyzing transactions with multiple filters.
Copy
name: analyze_transactionsdescription: | Analyze transactions with flexible filtering by date range, amount thresholds, and status. Use this to investigate suspicious activity or generate transaction reports.parameters: - name: start_date type: string required: true description: Start date (YYYY-MM-DD format) - name: end_date type: string required: true description: End date (YYYY-MM-DD format) - name: min_amount type: number required: false description: Minimum transaction amount to include - name: max_amount type: number required: false description: Maximum transaction amount to include - name: status type: string required: false description: Filter by status (pending, completed, failed, flagged)
SQL Template:
Copy
SELECT t.id, t.created_at, t.amount, t.currency, t.status, t.risk_score, c.email as customer_email, c.full_name as customer_nameFROM transactions tJOIN customers c ON c.id = t.customer_idWHERE t.created_at BETWEEN '{{start_date}}' AND '{{end_date}}' {{#if min_amount}}AND t.amount >= {{min_amount}}{{/if}} {{#if max_amount}}AND t.amount <= {{max_amount}}{{/if}} {{#if status}}AND t.status = '{{status}}'{{/if}}ORDER BY t.created_at DESCLIMIT 1000
A tool that calculates aggregate risk metrics for a customer.
Copy
name: calculate_risk_scoredescription: | Calculate comprehensive risk metrics for a customer including transaction velocity, average amounts, and flagged activity count. Returns risk indicators useful for compliance review.parameters: - name: customer_id type: string required: true description: Customer ID to analyze - name: days_back type: number required: false description: Number of days to analyze (default 30)
SQL Template:
Copy
WITH customer_stats AS ( SELECT customer_id, COUNT(*) as transaction_count, SUM(amount) as total_volume, AVG(amount) as avg_transaction, MAX(amount) as max_transaction, COUNT(CASE WHEN status = 'flagged' THEN 1 END) as flagged_count, COUNT(CASE WHEN risk_score > 0.7 THEN 1 END) as high_risk_count FROM transactions WHERE customer_id = '{{customer_id}}' AND created_at >= CURRENT_DATE - INTERVAL '{{days_back}} days' GROUP BY customer_id)SELECT cs.*, c.account_status, c.kyc_verified, c.created_at as account_age, CASE WHEN cs.flagged_count > 5 THEN 'HIGH' WHEN cs.flagged_count > 2 THEN 'MEDIUM' ELSE 'LOW' END as risk_levelFROM customer_stats csJOIN customers c ON c.id = cs.customer_id
Use CTEs (Common Table Expressions) to break complex queries into readable parts. The AI assistant will better understand and explain the results.