Skip to main content
Glama
kwonsw812

kiwoom-mcp

by kwonsw812

get_trade_history

Read-only

Retrieve daily or specific date trade records including buy/sell transactions and profit/loss details for Kiwoom Securities accounts, covering up to the past two months.

Instructions

당일 또는 특정 날짜의 매매일지(매수/매도 내역, 손익)를 조회합니다 (최근 2개월까지)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
base_dateNo조회일자 (미입력시 오늘) (YYYYMMDD 형식)
account_noNo계좌번호 (미입력시 기본 계좌 사용)

Implementation Reference

  • The underlying implementation of the trade history request logic.
    async getTradeHistory(accountNo: string, baseDate?: string) {
      return this.request("/api/dostk/acnt", "ka10170", {
        acc_no: accountNo,
        base_dt: baseDate ?? today(),
        ottks_tp: "2",
        ch_crd_tp: "0",
      });
    }
  • src/index.ts:640-657 (registration)
    MCP tool registration for 'get_trade_history', which calls the handler.
    server.tool(
      "get_trade_history",
      "당일 또는 특정 날짜의 매매일지(매수/매도 내역, 손익)를 조회합니다 (최근 2개월까지)",
      {
        base_date: dateSchema("조회일자 (미입력시 오늘)").optional(),
        account_no: accountNoSchema,
      },
      { readOnlyHint: true },
      async ({ base_date, account_no }) => {
        try {
          const acct = resolveAccountNo(account_no);
          const data = await client.getTradeHistory(acct, base_date);
          return textContent(formatTradeHistory(data));
        } catch (error) {
          return errorContent(formatError(error));
        }
      }
    );
Behavior3/5

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

The annotation 'readOnlyHint': true already indicates this is a safe read operation. The description adds useful behavioral context: it specifies the time constraint ('최근 2개월까지' - up to last 2 months) and clarifies that it retrieves detailed trade records including profit/loss. However, it doesn't mention other behavioral aspects like response format, pagination, or authentication requirements beyond what annotations provide.

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 in Korean that front-loads the core purpose and includes key constraints. Every element earns its place: the action (조회합니다), the resource (매매일지), the content details (매수/매도 내역, 손익), the scope (당일 또는 특정 날짜), and the limit (최근 2개월까지). There's no wasted verbiage.

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 (2 optional parameters, read-only operation), the description provides sufficient context. The annotation covers safety (readOnlyHint: true), and the schema fully documents parameters. The description adds meaningful constraints (2-month limit, profit/loss inclusion) and clarifies default behaviors (today's date, default account). However, without an output schema, some details about return values (e.g., structure of trade records) are missing, though not critically for a retrieval tool.

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?

Schema description coverage is 100%, with both parameters ('base_date', 'account_no') fully documented in the schema. The description mentions date and account aspects generally ('당일 또는 특정 날짜', '계좌번호') but doesn't add specific semantic details beyond what the schema already provides (e.g., format 'YYYYMMDD', default behaviors). Baseline 3 is appropriate since the schema carries the parameter documentation burden.

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: '조회합니다' (retrieve/query) for '매매일지' (trade history) including '매수/매도 내역, 손익' (buy/sell records, profit/loss). It specifies the scope ('당일 또는 특정 날짜', '최근 2개월까지' - today or specific date, up to last 2 months), which is helpful. However, it doesn't explicitly differentiate from sibling tools like 'get_account_balance' or 'get_portfolio_summary' in terms of data granularity or time range.

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

Usage Guidelines3/5

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

The description implies usage context by mentioning date ranges and optional parameters, but doesn't provide explicit guidance on when to use this tool versus alternatives. For example, it doesn't compare to 'get_portfolio_summary' for aggregated data or 'get_unfilled_orders' for pending trades. The context is clear (retrieve trade history), but no when-not-to-use or alternative tool references are included.

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/kwonsw812/kiwoom-mcp'

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