Skip to main content
Glama
juhemcp

Juhe Exchange Rates MCP Server

by juhemcp

query_exchange_rates

Convert currency using 3-letter codes to find real-time exchange rates, enabling accurate cross-currency calculations for financial tasks.

Instructions

根据货币的三位字母代码查询两者之间的兑换汇率

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
from_codeYes您希望转换的货币的三位字母货币代码。如:CNY
to_codeYes您希望转换为目标货币的三位字母货币代码。如:USD

Implementation Reference

  • The main handler function for the 'query_exchange_rates' tool, including the @mcp.tool decorator for registration and Pydantic Field definitions for input schema. It makes an HTTP POST request to the JUHE API to fetch exchange rates between two currencies and returns the result as TextContent.
    @mcp.tool(name="query_exchange_rates", description="根据货币的三位字母代码查询两者之间的兑换汇率")
    async def query_exchange_rates(
        from_code: str = Field(description="您希望转换的货币的三位字母货币代码。如:CNY"),
        to_code : str = Field(description="您希望转换为目标货币的三位字母货币代码。如:USD")
    ) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]:
        """根据城市、地区、区县名称查询当地实时天气预报情况"""
        url = f"{JUHE_EXCHANGE_API_BASE}/currency"
        params = {
            "version": "2",
            "from": from_code,
            "to": to_code,
            "key": JUHE_EXCHANGE_API_KEY
        }
        async with httpx.AsyncClient() as client:
            response = await client.post(url, params=params)
            data = response.json()
            if data["error_code"] == 0:
                result = data["result"]
                return [
                    types.TextContent(
                        type="text",
                        text=f"{result}"
                    )
                ]
            else:
                return [
                    types.TextContent(
                        type="text",
                        text=f"Error: {data['reason']}"
                    )
                ]
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. The description only states the tool queries exchange rates but doesn't mention any behavioral traits such as data freshness, rate limits, error handling, authentication requirements, or what happens if invalid codes are provided. This leaves significant gaps in understanding how the tool behaves in practice.

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 a single, efficient sentence that directly states the tool's purpose without any unnecessary words. It is appropriately sized and front-loaded, making it easy to understand at a glance. Every word earns its place in conveying the core functionality.

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

Completeness2/5

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

Given the lack of annotations and no output schema, the description is incomplete. It doesn't explain what the tool returns (e.g., rate value, timestamp, source), error conditions, or behavioral constraints. For a tool that performs data queries, this leaves the agent without enough context to use it effectively beyond the basic parameter requirements.

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?

The schema description coverage is 100%, with both parameters clearly documented in the input schema. The description adds no additional parameter semantics beyond what's already in the schema (e.g., it doesn't explain format constraints, examples beyond those in schema, or edge cases). According to the rules, when schema coverage is high (>80%), the baseline score is 3 even without param info in the description.

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: '查询两者之间的兑换汇率' (query the exchange rate between two currencies). It specifies the verb (query) and resource (exchange rates), but since there are no sibling tools, it doesn't need to distinguish from alternatives. The description is specific and unambiguous about what the tool does.

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, prerequisites, or contextual constraints. It simply states what the tool does without any usage instructions. Since there are no sibling tools, this is less critical, but still a gap in providing operational context.

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

Related 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/juhemcp/jexchange-mcp-server'

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