Skip to main content

Overview

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.

SQL Tool Examples

SQL tools execute queries against your connected databases with support for dynamic parameters and conditional logic.

Example 1: Customer Lookup Tool

A simple tool to look up customer information by ID or email.
1

Create the Tool

Go to MCP Studio > Tool Builder and click New Tool.
2

Configure Basic Settings

  • Name: lookup_customer
  • Description: Look up customer information by ID or email address. Returns customer profile, account status, and recent activity.
  • Category: Customer Data
3

Define Parameters

Add two parameters:
4

Write the SQL Template

The {{#if parameter}}...{{/if}} syntax creates conditional blocks. The SQL inside only executes if the parameter has a value.

Example 2: Transaction Analysis Tool

A more advanced tool for analyzing transactions with multiple filters.
SQL Template:

Example 3: Risk Score Calculator

A tool that calculates aggregate risk metrics for a customer.
SQL Template:
Use CTEs (Common Table Expressions) to break complex queries into readable parts. The AI assistant will better understand and explain the results.

Python Tool Examples

Python tools allow you to execute custom code with access to parameters, external APIs, and your connected databases.
To create a Python tool, go to MCP Studio > Tool Builder, click New Tool, and select Python from the tool type dropdown in the Plumi UI.

Example 1: API Data Fetcher

A tool that fetches data from an external API and processes it.
1

Create the Tool

Go to MCP Studio > Tool Builder, click New Tool, and select Python as the tool type.
2

Configure Basic Settings

  • Name: fetch_exchange_rates
  • Description: Fetch current exchange rates for a base currency. Returns rates for major currencies (USD, EUR, GBP, etc.).
3

Define Parameters

4

Write the Python Code

Example 2: Data Aggregation with Pandas

A tool that queries your database and performs pandas analysis.
Python Code:

Example 3: Alert Generator

A Python tool that analyzes data and generates alerts.
Python Code:

Parameter Types Reference


SQL Template Syntax

Basic Parameter Substitution

Conditional Blocks

Include SQL only when a parameter has a value:

Default Values

Set defaults in your parameter definition:

Python Tool Capabilities

Available Packages

Python tools have access to these pre-installed packages:
  • requests - HTTP requests to external APIs
  • pandas - Data manipulation and analysis
  • numpy - Numerical computing
  • json - JSON parsing
  • datetime - Date/time operations

Built-in Variables

Returning Results

Always return a dictionary or list:

Best Practices

Write Clear Descriptions

AI assistants use your tool description to decide when to use it. Be specific about what the tool does and what data it returns.

Validate Inputs

Use parameter types and required flags. For SQL tools, the template syntax prevents injection attacks.

Handle Edge Cases

Consider what happens with empty results, null values, or invalid parameters. Return helpful messages.

Test Thoroughly

Use the Testing Playground to verify your tool works with various inputs before deploying.
Security Note: Never hardcode credentials in your tools. Use environment variables or Plumi’s secure credential storage for API keys and secrets.