Skip to main content
Glama
Drakoxw

MCP Server Demo

by Drakoxw

get_exchange_rate

Convert currency values by retrieving real-time exchange rates between two specified currencies, returning null if an error occurs during the process.

Instructions

Obtiene la cotización entre dos monedas. Devuelve None si hay error.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
from_currencyYes
to_currencyYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • server.py:25-35 (handler)
    The get_exchange_rate tool implementation - decorated with @mcp.tool() and contains the handler logic that makes an API call to exchangerate-api.com to fetch exchange rates between two currencies
    @mcp.tool()
    def get_exchange_rate(from_currency: str, to_currency: str) -> float | None:
        """Obtiene la cotización entre dos monedas. Devuelve None si hay error."""
        try:
            response = requests.get(f"https://api.exchangerate-api.com/v4/latest/{from_currency}", timeout=5)
            response.raise_for_status()
            data = response.json()
            return data.get("rates", {}).get(to_currency)
        except Exception as e:
            print(f"Error al obtener cotización: {e}")
            return None
  • server.py:1-9 (registration)
    Server setup and FastMCP initialization - creates the MCP server instance that registers the tool decorator used by get_exchange_rate
    from mcp.server.fastmcp import FastMCP
    import requests
    import os
    from dotenv import load_dotenv
    
    load_dotenv()
    
    # Create an MCP server
    mcp = FastMCP("Demo", host="0.0.0.0", port=int(os.getenv("PORT", 8000)))
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions that it 'Devuelve None si hay error' (returns None if there's an error), which is useful error-handling information. However, it doesn't disclose other important behaviors like rate limits, authentication requirements, data sources, or whether it's a read-only operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise with just two sentences that efficiently communicate the core functionality and error behavior. Every word earns its place, and the information is front-loaded with the primary purpose stated first.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (currency conversion with two parameters) and the presence of an output schema (which handles return value documentation), the description provides adequate coverage. It states what the tool does and includes error behavior, though additional context about data sources or limitations would be beneficial.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description doesn't add any parameter-specific information beyond what's in the schema. It mentions 'dos monedas' (two currencies) which aligns with the two parameters, but provides no details about expected formats (currency codes, symbols), validation rules, or examples.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('Obtiene la cotización') and resource ('entre dos monedas'), making it immediately understandable. However, it doesn't explicitly differentiate from the only sibling tool 'sum', which is a completely different operation, so this isn't a significant gap.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. While the sibling 'sum' tool is unrelated (mathematical addition), there's no mention of prerequisites, limitations, or typical use cases for currency conversion.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/Drakoxw/mcp-server'

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