QUOTEZ
QUOTEZ over an in-memory MCP client, source=replay.
Every price below is generated. This repository bundles no real market data.
>>> list_symbols(group="*FX*")
{
"source": "replay",
"synthetic": true,
"count": 2,
"symbols": [
{"name": "SYNTH_FX_ALPHA", "description": "Synthetic FX pair Alpha", "digits": 5, "point": 1e-05},
{"name": "SYNTH_FX_BETA", "description": "Synthetic FX pair Beta", "digits": 3, "point": 0.001}
]
}
>>> get_quote(symbol="SYNTH_FX_ALPHA")
{
"symbol": "SYNTH_FX_ALPHA",
"time": "2026-06-12T13:59:00Z",
"bid": 1.08044,
"ask": 1.08056,
"spread_points": 12,
"source": "replay",
"synthetic": true
}
>>> get_bars(symbol="SYNTH_FX_ALPHA", timeframe="H1", count=5)
{
"symbol": "SYNTH_FX_ALPHA",
"timeframe": "H1",
"source": "replay",
"synthetic": true,
"count": 5,
"bars": [
{"time": "2026-06-12T08:00:00Z", "open": 1.07985, "high": 1.08231, "low": 1.07978, "close": 1.08125, "tick_volume": 4257, "spread": null},
{"time": "2026-06-12T09:00:00Z", "open": 1.08125, "high": 1.0844, "low": 1.08113, "close": 1.08302, "tick_volume": 2501, "spread": null},
{"time": "2026-06-12T10:00:00Z", "open": 1.08302, "high": 1.08439, "low": 1.08298, "close": 1.08368, "tick_volume": 1643, "spread": null},
{"time": "2026-06-12T11:00:00Z", "open": 1.08368, "high": 1.08395, "low": 1.08036, "close": 1.08097, "tick_volume": 1570, "spread": null},
{"time": "2026-06-12T12:00:00Z", "open": 1.08097, "high": 1.08284, "low": 1.08084, "close": 1.08159, "tick_volume": 2589, "spread": null}
]
}
>>> symbol_info(symbol="SYNTH_FX_ALPHA")
{
"name": "SYNTH_FX_ALPHA",
"description": "Synthetic FX pair Alpha",
"digits": 5,
"point": 1e-05,
"spread": 12,
"spread_float": true,
"trade_stops_level": 10,
"trade_freeze_level": 0,
"trade_tick_value": 1.0,
"trade_tick_size": 1e-05,
"trade_contract_size": 100000.0,
"volume_min": 0.01,
"volume_max": 100.0,
"volume_step": 0.01,
"currency_base": "SYA",
"currency_profit": "SYN",
"currency_margin": "SYA",
"source": "replay",
"synthetic": true
}
A symbol that does not exist, to show what the model actually sees:
>>> get_quote(symbol="NOT_A_SYMBOL")
is_error: true
Error executing tool get_quote: Symbol 'NOT_A_SYMBOL' is not available on this server.uvx --from git+https://github.com/PNX89/QUOTEZ quotez --source replaygit clone https://github.com/PNX89/QUOTEZ && cd QUOTEZ
uv run python examples/agent_session.pyuvx --from "quotez[mt5] @ git+https://github.com/PNX89/QUOTEZ" quotez --source mt5{
"mcpServers": {
"quotez": {
"command": "/absolute/path/to/uv",
"args": ["tool", "run", "--from", "git+https://github.com/PNX89/QUOTEZ",
"quotez", "--source", "replay"]
}
}
}flowchart LR
host["MCP host<br/>Claude Desktop, Cursor, VS Code"]
server["quotez.server<br/>8 tools, 1 resource"]
proto["MarketDataSource<br/>Protocol"]
replay["ReplaySource<br/>bundled CSVs, any OS"]
mt5["Mt5Source<br/>Windows only, lazy import"]
term["MetaTrader 5 terminal"]
host -- "JSON-RPC over stdio" --> server
server --> proto
proto --> replay
proto --> mt5
mt5 -- "read calls only" --> termM1 是唯一的基础时间框架。所有更粗的时间粒度均由它派生。
桶按挂钟时间计算,通过对纪元秒进行整除除法得到,绝不按位置对每 N 行进行分组。
目标必须是 60 秒的整数倍。其他任何值都会引发
InvalidRequest。OHLC 依次为:第一笔开盘价、最高价中的最大值、最低价中的最小值、最后一笔收盘价。
tick_volume是求和值。spread不是:它是报价的一个时间点属性,因此聚合后的 K 线报告null。K 线以其左边界标记,时间采用 UTC。
不完整的尾部桶会被丢弃,不会作为部分 K 线发出。只有当输入包含该桶结束时间或之后的 K 线时,才会发出该桶。
空输入返回空列表。
不变量 2 值得测试。位置分组与挂钟时间分桶在无间隙序列上结果一致,但一旦出现间隙就会产生分歧:将 360 根 K 线按每 4 根分组,会把周五的收盘价和周一的开盘价合并到一根 K 线中,并称之为四小时 K 线。不变量 7 与之配对,因为会话结束与数据耗尽不是同一事件。
安全设计
此声明是结构性的,不可配置。此代码库不包含任何写入路径。 在 src/quotez/ 中,没有 order_send、没有 order_check、没有 symbol_select、没有 MarketWatch 的修改,也没有任何文件写入。没有任何配置可以启用写入功能,因为根本没有任何东西可以启用。
有两个测试确保了这一点,其中第二个测试才是真正有意义的。第一个测试在包中搜索那三个 MetaTrader 调用:成本低廉,覆盖所有文件,并且可以通过运行时拼接的名称来满足。第二个测试遍历 mt5source.py 的 AST,并断言正向属性:此包从终端模块读取的属性集合,恰好是其自身文档字符串中命名的读取调用加上七个时间框架常量,没有通过 getattr 访问任何内容,也没有将任何内容重新绑定到第二个变量。_mt5() 返回整个 MetaTrader5 模块,因此仅凭数百个属性中缺少三个名称,其本身并不能证明什么。有五个故意破坏的代码片段会针对该遍历进行检查,以便在遍历本应失败时,我们能够确知它确实会失败。
每个工具都声明了 ToolAnnotations(read_only_hint=True, open_world_hint=False)。该声明仅是对客户端的礼貌提示,仅此而已:MCP 规范告诉客户端,除非工具注解来自受信任的服务器,否则应将其视为不可信。read_only_hint=True 描述的是工具本身,它并不约束客户端,审查者可以检查的属性是缺少相关调用,而不是存在该标志。映射到规范自身的安全注意事项,包括此服务器未满足的要求:
规范要求 | QUOTEZ | 位置 |
验证所有工具输入 | 是 | 从类型提示派生的 JSON Schema, |
实施适当的访问控制 | 是 | 符号白名单应用于所有工具和资源,而不仅仅是获取器 |
对工具调用进行速率限制 | 否 | 未实现,并在限制中列出。stdio 服务器恰好是一个主机的子进程,因此主机负责速率限制 |
清理工具输出 | 是 | 账户登录名被屏蔽为最后四位数字,经纪人、服务器和账户持有人姓名永远不会返回,并且 |
被阻止的符号会报告为 SymbolNotFound,并附带与拼写错误相同的消息:“Symbol 'X' is not available on this server.”。如果使用不同的“不允许”消息,则会将白名单变成操作员选择不公开的品种的发现预言机。
错误通过两个渠道之一传递,选择依据是更智能的模型是否本可以避免该失败。拼写错误的符号是可以避免的,因此 SymbolNotFound 和 InvalidRequest 是普通异常,会变成模型可以读取并重试的工具错误。而终端未运行则无法避免,因此 SourceUnavailable 会作为 MCPError 引发,这是一种协议错误,完全不返回任何结果。这里没有任何内容返回错误字符串:返回的字符串携带 is_error=False,并作为成功答案读取。有一个测试使用错误输入调用每个工具,并断言该标志。
Related MCP server: ibkr-mcp
设计决策
使用 mcp>=2.0.0,<3 和 MCPServer,而不是 v1 固定版本和 FastMCP。 SDK 仍然为尚未迁移的人提供 mcp>=1.28,<2,但 v1 时代的服务器会在三秒内暴露自己:from mcp.server.fastmcp import FastMCP。迁移指南 提供了重命名后的名称。低级别的 Server 是另一种选择,但它不再自动包装返回值,这意味着需要为八个工具手动编写 JSON Schema。
使用类型化的 Pydantic 返回值,而不是文本块。 大多数公共 MCP 服务器返回散文,让模型去解析。这里返回注解就是输出模式,因此类型化无需额外成本,并在负载离开服务器之前提供验证。
使用两个 K 线工具,而不是一个带有可选参数的。 JSON Schema 无法表达互斥性,因此单个 get_bars(count or start..end) 会将“两者选一,但不能同时”作为散文推给模型。两个工具有两个完全有效的模式,而“两者都给出,两者都不给出”的错误类则不存在。
使用生成的数据,而不是真实的数据源。 这是一个许可决策,而非偏好。MetaTrader 的导出数据是经纪商许可的数据源,对于指数和股票差价合约,底层数据是交易所许可的。Yahoo 的帮助页面明确说明了限制:您不得重新分发 Yahoo Finance 上显示或提供的信息,并且其开发者 API 条款 另外限制了出售或再许可访问权限。HistData 的常见问题解答 未授予任何再分发权利;它仅说明数据不附带任何保证,而沉默并非许可。将其中任何数据提交到 MIT 仓库,都将重新许可我无权重新许可的数据。
使用标准库,而不是 pandas 或 numpy。 对于捆绑的 CSV 规模,csv 加上 datetime 加上数据类就足够了,并且代码树保持可审计。不过,这个代码树值得诚实命名,全部列出:mcp 2.x 是一个直接依赖项,它会拉入 anyio、httpx2、jsonschema、mcp-types、opentelemetry-api、pydantic、pyjwt(及其加密扩展)、python-multipart、sse-starlette、starlette、typing-extensions、typing-inspection 和 uvicorn,以及在 Windows 上的 pywin32。加密扩展会进一步引入 cryptography、cffi 和 pycparser。这比 v1 的占用空间更大,并且有一个测试会读取已提交的 uv.lock,如果此列表与之不匹配则失败,因为一个旨在命名代码树的段落,如果只命名了代码树的大部分,那就毫无价值。
没有 run_backtest 工具。 回测的计算量无界,需要的远不止 MarketDataSource,并且会与 QUACKZ 重复,因此这对组合看起来像是两个半成品项目,而不是两个专注的项目。出于同样的原因,这里的护栏是领域本地的:输入验证、有界查询、固定的品种范围、无副作用。通用代理护栏属于 QUELLZ,不应在此重复发明。
限制
没有持续集成运行器在任何地方执行实时 MetaTrader 路径。 没有非 Windows 的 wheel,也没有运行器拥有终端或经纪商账户。Windows 作业仅证明扩展可以导入,并且
Mt5Source能干净地报告缺少终端,仅此而已。Mt5Source的字段映射是这里测试最少的代码,由假模块测试覆盖。MetaTrader5仅限 Windows,并且不发布源代码分发,因此pip install quotez[mt5]在 macOS 和 Linux 上按设计是空操作。有一个测试断言环境标记确保了这一点。initialize()会启动终端(如果尚未运行),整个操作受其timeout参数限制,该参数文档中默认值为 60000 毫秒。该页面没有给出启动本身的具体数值,因此请将 60 秒视为调用的上限,而不是测量的启动时间。QUOTEZ 在服务器生命周期内只打开一次连接,而不是每次调用都打开,因此无论其成本如何,都发生在启动时,而不是让第一次工具调用看起来像挂起。两个数据源在 D1 或 H4 桶的起始位置不一致。 回放聚合基于纪元秒进行整除,因此 D1 在 UTC 时间 00:00 开盘,H4 在 UTC 时间 00、04、08、12、16 和 20 点开盘。MetaTrader 终端将 D1 和 H4 与经纪商的服务器日对齐,通常是 UTC+2 或 UTC+3,因此根据配置的数据源,相同的
get_bars(symbol, "D1")会返回具有不同开盘时间和不同 OHLC 的 K 线。这里没有对终端的 M1 进行重采样来隐藏这一点,因为一根与操作员自己的图表不一致的 K 线,比有记录的偏移更糟糕。出于同样的原因,
spread在 M1 以上的每个回放 K 线上都是 null,并在每个 MetaTrader K 线上设置。聚合会故意清除它;终端会在每个时间框架上报告自己的值,QUOTEZ 会透传该值,而不是丢弃数据源提供的数据。copy_rates_from_pos和copy_rates_range会被终端的“图表中最大 K 线数”设置静默限制,因此即使在服务器自身限制内的请求,也可能返回不足的数据,而 MetaTrader API 中没有任何说明。get_bars会跳过终端仍在构建的 K 线,因此其最新的 K 线始终是已收盘的。get_bars_range则不会,因为边界由调用者决定:如果end在当前区间内,则返回该区间的部分 K 线。symbol_info()对于未知符号会返回None,而不是引发异常,symbols_get()在出错时也是如此。这里的每个调用点都会进行检查,但这就是被包装的 API 的形状。MetaTrader 以 UTC 时间存储 K 线和 Tick 时间,不进行偏移,而朴素的 Python
datetime会相对于本地时区进行解析;copy_rates_range 文档 说明了这一点。每个出站时间戳都使用tz=UTC构建,并且朴素的输入会被拒绝,但这是一个陷阱,会静默地将整个序列偏移一个小时。没有速率限制。stdio 服务器恰好是一个主机的子进程,主机负责速率限制。
回放数据是样本规模且是生成的:4 个品种,每个 3600 根 M1 K 线,共十个交易日。它用于演示工具和测试聚合,既不是研究数据集,也不是市场数据。
版本 0.1.0 是只读且仅限 stdio 的,没有提示功能,没有 SSE 或流式 HTTP 传输,也没有 OAuth。
我为什么构建这个
我在指数数据上运行向前验证研究,并保留 MetaTrader 终端用于外汇和金属部分,因此这两部分内容早已在我的工作台上。促使我写下这些的,是看到一个智能体从一个类型错误的工具中复述一个数字,仿佛它是事实,没有单位、没有时区,也没有说明其来源。在市场数据中,这并非表面问题:一个以收盘价而非开盘价标记的柱线,或一个悄然转换为本地时间的时间戳,会给出一个看似正确却偏差一小时的答案。因此,这主要涉及关于数据来源和工具可声称内容的决策,并围绕少量聚合代码展开。
开发
uv sync --dev
uv run pytest
uv run ruff check .
uv run ruff format --check .
uv run mypy251 个测试,无需网络,耗时数秒,在 macOS、Linux 和 Windows 上结果一致。该计数基于实际运行集合断言,因为 README 中的数字是无人更新的数字。
许可证
MIT。参见 LICENSE。
属于 Q...Z 工具集的一部分,五个针对不自我宣告的失败的工具:
Available Tools
8 toolsget_accountGet account stateARead-only
Return the connected account's balance, equity, margin and leverage.
The login is masked to its last four digits and the broker, server and account holder names are never returned. On the replay source these figures are invented placeholders describing no real account: the payload carries synthetic=true, the currency is SYN and the login is ****0000. Do not restate them as a real balance.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
Output Schema
| Name | Required | Description |
|---|---|---|
| equity | Yes | Balance plus floating profit and loss. |
| margin | Yes | Margin currently in use. |
| source | Yes | Data source that produced these figures. |
| balance | Yes | Balance, excluding floating profit and loss. |
| currency | Yes | Account deposit currency. |
| leverage | Yes | Account leverage, for example 100 for 1:100. |
| synthetic | Yes | True when the figures are generated. The replay source always sets this, and its balance and equity are invented placeholders that describe no real account. |
| margin_free | Yes | Margin available for new positions. |
| login_masked | Yes | Account login masked to its last four digits. The full login is never returned. |
| margin_level | Yes | Equity divided by margin, as a percentage. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
The description discloses key behavioral traits beyond annotations: login masking, omission of broker/server/account holder names, and synthetic data indicators on replay. This adds significant value over the readOnlyHint and openWorldHint annotations.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is three sentences long, front-loaded with the main purpose, and every sentence adds essential information. There is no redundancy or wasted language.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool has no parameters and an output schema exists, the description adequately covers the return values and adds critical context about data masking and synthetic mode. It is complete for an agent to understand and invoke the tool correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The tool has no parameters and schema coverage is 100%, so the baseline is 3. The description does not add meaning to any parameters because there are none to explain; it appropriately focuses on the tool's output and behavior.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb 'Return' and the specific resource 'connected account's balance, equity, margin and leverage'. This distinguishes it from sibling tools like list_symbols, get_quote, and get_bars, which operate on different data.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides clear context about when the tool returns synthetic data on the replay source and warns against restating it as real. It does not explicitly contrast with siblings, but the context is sufficient for an agent to understand when to use this tool.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_barsGet recent barsARead-only
Return the most recent OHLCV bars for a symbol, oldest first.
Times are UTC and label each bar's OPEN, the left edge of the interval it covers.
count is capped by the server (see the server instructions for the current
limit); ask for a coarser timeframe rather than more bars. The bar that is still
forming is never returned, so the newest bar is always a closed one; call get_quote
for the current price. An unknown or unavailable symbol returns a tool error naming
the symbol; call list_symbols first if unsure. On the replay source the prices are
generated, not recorded from any market.
| Name | Required | Description | Default |
|---|---|---|---|
| count | No | How many of the most recent bars to return, newest last. | |
| symbol | Yes | Instrument name exactly as list_symbols spells it. | |
| timeframe | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| bars | Yes | The bars, oldest first. |
| count | Yes | Number of bars returned. |
| source | Yes | Data source that produced these bars. |
| symbol | Yes | Symbol these bars belong to. |
| synthetic | Yes | True when the prices are generated, not observed. |
| timeframe | Yes | Timeframe of each bar. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
The description discloses critical behavioral traits beyond annotations: bars are in UTC labeling the open, the newest bar is always closed (never returns forming bar), the server caps count, and on replay source prices are generated (not recorded). The readOnlyHint annotation is consistent with the read-only nature described, and no contradiction exists.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is concise (5 sentences) and front-loaded: first sentence states the core purpose and ordering. Every sentence adds distinct value (timezone, counting strategy, bar state, error handling, data source). No wasted words.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool has 3 parameters, an output schema (present), and annotations (readOnlyHint, openWorldHint), the description covers all necessary context: purpose, parameters, error handling, alternatives, and data source behavior. The output schema likely describes return format, so no need to explain return values. Complete for a moderately complex tool.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 67% (only 2 of 3 parameters have descriptions). The description adds value: clarifies that 'count' is capped by server ('ask for a coarser timeframe rather than more bars'), that 'symbol' must match list_symbols spelling, and that 'timeframe' is the interval length. The description compensates for the missing schema description on 'timeframe' by listing enum values contextually (M1, M5, etc.) and implying the left-edge labeling. However, it doesn't explain the 'timeframe' enum beyond listing intervals, so a 4 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool returns 'the most recent OHLCV bars for a symbol, oldest first'. It identifies the specific verb (return), resource (OHLCV bars), and ordering (oldest first), distinguishing it from siblings like get_quote (current price) and get_bars_range (range-based).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides explicit guidance: when to use alternatives ('call get_quote for the current price'), when to call list_symbols first ('call list_symbols first if unsure'), how to handle timeframes ('ask for a coarser timeframe rather than more bars'), and error handling ('An unknown or unavailable symbol returns a tool error naming the symbol'). It also notes the 'count' cap and server limit.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_bars_rangeGet bars in a date rangeARead-only
Return the OHLCV bars whose open time falls in [start, end), oldest first.
Both bounds must carry a UTC offset, for example 2026-06-01T08:00:00Z. start is
inclusive and end is exclusive, so consecutive ranges tile without repeating a
bar. The number of bars the range spans is capped by the same limit that applies to
get_bars, so a wide window at a fine timeframe returns a tool error asking for a
coarser one rather than a truncated answer. Unlike get_bars, an end that reaches
into the interval currently forming can return that bar, because the bounds are
yours; stop end at a closed interval if that matters. On the replay source the
prices are generated, not recorded from any market.
| Name | Required | Description | Default |
|---|---|---|---|
| end | Yes | Exclusive, ISO 8601, UTC. | |
| start | Yes | Inclusive, ISO 8601, UTC. | |
| symbol | Yes | Instrument name exactly as list_symbols spells it. | |
| timeframe | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| bars | Yes | The bars, oldest first. |
| count | Yes | Number of bars returned. |
| source | Yes | Data source that produced these bars. |
| symbol | Yes | Symbol these bars belong to. |
| synthetic | Yes | True when the prices are generated, not observed. |
| timeframe | Yes | Timeframe of each bar. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
The description goes well beyond the readOnlyHint annotation, explaining the inclusive/exclusive bounds, UTC offset requirement, tiling behavior, error on exceeding limits, the nuance with forming bars, and the synthetic nature of replay data. This gives the agent a full behavioral model.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is front-loaded with the core purpose, and every subsequent sentence adds essential behavioral or usage detail. It is concise given the complexity, with no redundant wording.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description covers not only the basic operation but also edge cases like limit-caused errors, the difference from get_bars, data source caveat, and formatting requirements. Given the output schema exists, return values need no explanation, and the description is fully sufficient for an agent to invoke the tool correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema already covers 75% of parameters with descriptions, but the description adds critical semantics for start/end (inclusive/exclusive, UTC offset, example format) and clarifies the meaning of range-related behavior beyond the schema. Timeframe is only an enum, but the values are self-explanatory.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool returns OHLCV bars within a half-open date range, ordered oldest first. The title 'Get bars in a date range' plus the explicit interval notation [start, end) distinguishes it from its sibling get_bars.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description references get_bars multiple times, noting the same limit applies and highlighting a key difference regarding forming bars. This provides clear comparative context, though it does not include a direct 'use this when' statement or explicit when-not-to-use guidance.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_quoteGet a quoteARead-only
Return the latest bid, ask and spread in points for one instrument.
The time is UTC. On the replay source it is the last stored bar's open time rather than the current clock, so the answer is reproducible and is NOT a live market price. An unknown or unavailable symbol returns a tool error naming the symbol; call list_symbols if unsure.
| Name | Required | Description | Default |
|---|---|---|---|
| symbol | Yes | Instrument name exactly as list_symbols spells it. |
Output Schema
| Name | Required | Description |
|---|---|---|
| ask | Yes | Best ask price. |
| bid | Yes | Best bid price. |
| time | Yes | Quote time in UTC. On the replay source this is the last stored bar's open time, never the wall clock. |
| source | Yes | Data source that produced this quote. |
| symbol | Yes | Symbol this quote belongs to. |
| synthetic | Yes | True when the price is generated, not observed. |
| spread_points | Yes | Ask minus bid, expressed in points. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
The description discloses crucial behavior beyond the annotations: 'On the replay source it is the last stored bar's open time rather than the current clock, so the answer is reproducible and is NOT a live market price.' It also details error handling for unknown symbols. This adds significant context for an agent deciding whether to trust the result as live.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is two short sentences plus a crucial behavioral note. Every sentence adds value, and the key action ('Return...') is front-loaded. No redundant or vague language. It is concise without omitting necessary information.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's simplicity (one required parameter, no nested types) and the existence of an output schema (not shown but indicated in context signals), the description adequately covers the return value, time source, error behavior, and a pointer to list_symbols. It is complete for an agent to use correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has 100% coverage for its single parameter 'symbol', with description 'Instrument name exactly as list_symbols spells it.' The tool description does not add new semantic meaning; it only repeats the schema's point about exact spelling. Baseline 3 is appropriate when schema already fully documents the parameter.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states 'Return the latest bid, ask and spread in points for one instrument.' The verb 'return' and resource 'quote for one instrument' are specific. It implicitly distinguishes from sibling tools like get_bars (historical bars) and list_symbols (listing symbols).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides explicit guidance: 'An unknown or unavailable symbol returns a tool error naming the symbol; call list_symbols if unsure.' This tells the agent when to use list_symbols instead. It does not explicitly state when not to use this tool (e.g., for historical prices use get_bars), but the sibling context and the mention of 'latest' imply the appropriate use case.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_ordersList pending ordersARead-only
Return every pending order, with its type, volumes and trigger price.
Read only: this server can place, modify and cancel nothing. On the replay source the list is always empty and the payload carries synthetic=true.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
Output Schema
| Name | Required | Description |
|---|---|---|
| count | Yes | Number of pending orders. |
| orders | Yes | The pending orders. |
| source | Yes | Data source that produced this list. |
| synthetic | Yes | True when the orders are generated, not real. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already mark readOnlyHint=true. The description reinforces this with 'this server can place, modify and cancel nothing' and adds critical context about the replay source (list always empty, synthetic flag). This goes beyond what annotations provide, though it does not cover all possible behavioral traits (e.g., rate limits, auth needs).
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is three sentences, each earning its place: purpose, read-only assertion, and replay-specific behavior. No unnecessary words, front-loaded with the core action.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The tool has no parameters and an output schema exists. The description covers return fields and a key behavioral detail about replay sources, making it fully adequate for the low complexity of this tool.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
With zero parameters and 100% schema coverage, the description need not add parameter-level meaning. It correctly describes the output fields but not parameter semantics; baseline 3 is appropriate as the schema carries the full load.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb 'Return' and the resource 'every pending order', and specifies the data included (type, volumes, trigger price). It differentiates from sibling tools which deal with symbols, quotes, bars, account, and positions, leaving no ambiguity about what this tool does.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage for retrieving pending orders and includes the read-only note, but does not explicitly say when to use this tool over alternatives like list_positions. It lacks mentions of conditions under which the tool should or should not be used, nor does it reference sibling tools for comparison.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_positionsList open positionsARead-only
Return every open position, with entry price, current price and floating profit.
Read only: this server can open, modify and close nothing. On the replay source the list is always empty and the payload carries synthetic=true.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
Output Schema
| Name | Required | Description |
|---|---|---|
| count | Yes | Number of open positions. |
| source | Yes | Data source that produced this list. |
| positions | Yes | The open positions. |
| synthetic | Yes | True when the positions are generated, not real. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint=true and openWorldHint=false. The description adds value beyond annotations by stating the server can 'open, modify and close nothing', and explains the synthetic flag behavior on replay sources. This provides meaningful behavioral context without contradiction.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is two short sentences, each providing essential information. No filler or redundancy. Perfectly sized for a tool with no parameters and clear purpose.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given no parameters and an output schema present, the description is largely complete. It explains the tool's purpose, return fields, and special behavior (read-only, synthetic flag on replay). One minor gap: it doesn't mention whether the list is always empty in certain modes beyond replay.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has no parameters, so the description has no responsibility to document parameters. With 0 parameters and 100% schema coverage, the description adds value by explaining return fields (entry price, current price, floating profit), which aids correct invocation and interpretation.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses a specific verb ('Return') and resource ('open position'), and lists the fields returned (entry price, current price, floating profit). It clearly distinguishes this tool from siblings like `list_symbols` and `list_orders`.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description clarifies that the tool is read-only and explains behavior on replay sources (always empty, payload has synthetic=true). However, it doesn't explicitly state when to use this tool over alternatives like `get_account` or `list_orders`, though the purpose is clear enough.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_symbolsList instrumentsARead-only
Return every instrument this server exposes, with its digits and point size.
Call this before anything else: it is the only authoritative list of symbol names, and a name that is not in it produces a tool error everywhere else. The optional group filter uses MetaTrader's own syntax, described in the argument. On the replay source the instruments are generated and the payload carries synthetic=true.
| Name | Required | Description | Default |
|---|---|---|---|
| group | No | Optional filter. MetaTrader group syntax: '*' wildcards at the start and end of a pattern, several comma separated conditions, and '!' to negate one. Inclusions must come before exclusions, so "*, !*USD*" is everything except the USD instruments while "!*USD*, *" matches everything. |
Output Schema
| Name | Required | Description |
|---|---|---|
| count | Yes | Number of instruments returned. |
| source | Yes | Data source that produced this list. |
| symbols | Yes | The instruments, in source order. |
| synthetic | Yes | True when the instruments are generated, not real. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint=true (safe read) and openWorldHint=false (closed set). The description adds value by noting that missing symbols cause errors in other tools, and that replay sources return synthetic=true. This complements the annotations without contradicting them.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is three sentences with zero wasted words. Each sentence serves a distinct purpose: stating the return value, explaining when to call and consequences, and describing the optional filter. Information is front-loaded with the core purpose first.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's simplicity (1 optional parameter, read-only, closed set), output schema exists, and annotations are clear, the description is fully complete. It covers purpose, usage guidance, parameter behavior, and edge cases (replay vs. live), leaving no gaps for an agent.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100% and already documents the group parameter syntax thoroughly. The description reinforces this by referencing the syntax explanation in the argument description, adding the context of how the filter interacts with the overall tool purpose, which is helpful for an agent.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool returns 'every instrument this server exposes, with its digits and point size'. It uses a specific verb ('Return') and resource ('every instrument'), and distinguishes itself from siblings like get_quote and symbol_info by positioning itself as the authoritative source of symbol names.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Explicitly advises 'Call this before anything else', warns that missing names cause errors elsewhere, explains the optional group filter's syntax, and clarifies behavior differences on replay sources. No alternative tools are needed for this purpose, and it sets clear prerequisites for using other tools.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
symbol_infoGet contract specificationARead-only
Return the contract specification for one instrument.
Digits and point size for rounding prices, current spread, minimum stop distance, tick value and size, contract size, the tradable volume range, and the base, profit and margin currencies. Field names are MetaTrader's own. An unknown or unavailable symbol returns a tool error naming the symbol. On the replay source the instrument is generated and the payload carries synthetic=true.
| Name | Required | Description | Default |
|---|---|---|---|
| symbol | Yes | Instrument name exactly as list_symbols spells it. |
Output Schema
| Name | Required | Description |
|---|---|---|
| name | Yes | Symbol name. |
| point | Yes | Value of one point, the smallest price step. |
| digits | Yes | Decimal places in a quoted price. |
| source | Yes | Data source that produced this specification. |
| spread | Yes | Current spread in points. |
| synthetic | Yes | True when the instrument is generated, not real. |
| volume_max | Yes | Largest tradable volume, in lots. |
| volume_min | Yes | Smallest tradable volume, in lots. |
| description | Yes | Human readable instrument name. |
| volume_step | Yes | Volume increment, in lots. |
| spread_float | Yes | True when the broker quotes a floating spread. |
| currency_base | Yes | Base currency of the instrument. |
| currency_margin | Yes | Currency the margin is charged in. |
| currency_profit | Yes | Currency the profit is denominated in. |
| trade_tick_size | Yes | Smallest price change, in price units. |
| trade_tick_value | Yes | Profit in the account currency from a one tick move on one lot. |
| trade_stops_level | Yes | Minimum distance in points between price and a stop or limit order. |
| trade_freeze_level | Yes | Distance in points within which orders are frozen and cannot be changed. |
| trade_contract_size | Yes | Units of the base asset in one lot. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint=true, so the tool is safe to call without side effects. The description adds behavioral context: it lists the exact return fields (digits, spread, tick value, etc.), notes that unknown symbols cause a tool error, and mentions that on replay sources synthetic=true is added. This goes beyond annotations without contradicting them.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is concise (three sentences) and front-loaded with the purpose. Each sentence adds relevant detail (return fields, naming, edge cases). Slightly verbose in listing fields could be trimmed, but it remains efficient.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given that there is no output schema but an output schema exists (context says 'Has output schema: true'), the description thoroughly lists return fields and covers the key edge case of unknown symbols. With annotations providing read-only guarantee, and one simple parameter, the description is complete enough for an agent to use correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Even though schema coverage is 100% and the single parameter 'symbol' has a description, the description adds value by indicating that symbol names must match list_symbols exactly and that unknown symbols trigger an error. This aids correct invocation.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states 'Return the contract specification for one instrument,' which identifies the action (return) and the resource (contract specification for one instrument). It distinguishes itself from siblings like 'list_symbols' (which lists symbols, not specifications) and 'get_quote' (which gets quotes) by focusing on static contract details.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage when needing instrument specifications (digits, spread, tick value, etc.) but does not explicitly state when to use this tool versus alternatives. It mentions that an unknown symbol returns a tool error, which is helpful context. No explicit exclusions or alternatives are given, but the context is clear.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
8 tool updates
v0.1.0- First observed
get_account - First observed
get_bars - First observed
get_bars_range - First observed
get_quote - First observed
list_orders - First observed
list_positions - First observed
list_symbols - First observed
symbol_info
TDQS
Scored across 8 tools
Each tool targets a distinct concern: symbol discovery, current quote, recent bars, ranged bars, contract specs, account summary, positions, and orders. The overlap between get_bars and get_bars_range is clearly delineated by recent-count vs. explicit time range, and descriptions reinforce the boundary.
The set mostly follows a clear list_* for enumerations and get_* for single-item or snapshot retrievals. The one deviation is symbol_info, which lacks the get_ prefix, but the overall pattern remains predictable and readable.
Eight tools is well-scoped for a read-only market data and account snapshot server. Each tool contributes a distinct capability without redundancy or bloat, and the count fits comfortably within the ideal range.
The surface covers symbol discovery, live quotes, historical bars, contract specifications, account summary, positions, and orders, with explicit read-only constraints explaining why trading mutations are absent. There are no obvious dead ends: list_symbols feeds the symbol-dependent tools, and get_bars/get_bars_range cover both recent and range-based history.
Maintenance
Related MCP Connectors
MCP server for OpenMM — exposes market data, account, trading, and strategy tools to AI agents
MCP server exposing the Backtest360 engine API as tools for AI agents.
Market Data App MCP — wraps the Market Data App API (marketdata.app)
Connect any MCP client to MetaTrader 4/5 to read prices, manage positions, and place trades.
Related MCP Servers
- AlicenseNot gradedqualityAmaintenanceExposes a unified AI interface to MetaTrader 5 over the Model Context Protocol, enabling live quotes, historical data, technical indicators, order execution, position management, and headless backtests.MIT
- AlicenseAqualityCmaintenanceRead-only MCP server for Interactive Brokers that exposes market data, positions, and account info as MCP tools.8MIT
- AlicenseNot gradedqualityCmaintenanceA local-first MCP server that bridges AI coding agents with MetaTrader 5 for inspection, market data, MQL5 development, compiling, Strategy Tester review, workspace sync, logs, audit trails, demo trading, and carefully gated live trading.MIT
- FlicenseNot gradedqualityCmaintenanceRead-only MCP server exposing MetaTrader 5 account and market data alongside Twelve Data quotes and technical indicators, with an LLM analysis layer.-