Skip to main content
Glama
Johnhyeon

StockLens

by Johnhyeon

get_sector_valuation

Read-onlyIdempotent

Compare any stock's valuation against its sector using median PER, PBR, and ROE. Input a sector name or stock code to identify whether it trades at a discount or premium to peer companies.

Instructions

업종밸류에이션 — 업종·테마의 PER·PBR·ROE 집계와 종목별 할증/할인 위치.

"반도체 업종 평균 PER", "이 업종에서 싼 편인가", "동종 대비 할증인가" 같은 질문에 사용합니다. 개별 종목 지표(get_financial)로는 알 수 없는 비교 기준을 만듭니다.

통계는 중앙값이 기준입니다. 평균은 적자 기업과 극단값(PER 500배 등)에 쉽게 흔들려 업종 대표값으로 쓰기 어렵습니다.

집계는 항상 업종 전체로 하고, top_n 은 아래 위치 표에 몇 종목을 보여줄지만 정합니다 - top_n 을 바꿔도 중앙값은 변하지 않습니다. (업종이 집계 상한을 넘으면 전체 중앙값 대신 표본 중앙값(sample_median) 으로 이름을 낮춰 표기합니다.)

⚠️ 적자 기업의 PER은 음수로 나오며 집계에서 제외합니다(제외 건수를 함께 표기).

종목코드만 넘겨도 됩니다code="005930" 이면 그 종목의 업종을 찾아 집계한 뒤, 그 종목이 업종 안에서 어디에 있는지 표시합니다. 업종명을 모를 때 이 방식을 쓰세요(ETF·ETN은 소속 업종이 없어 조회되지 않습니다).

Args: sector_name: 업종명 또는 테마명 (예: "반도체와반도체장비", "건설"). code 를 주면 생략할 수 있습니다. top_n: 위치 표에 표시할 종목 수 (기본 40, 최대 80). 집계 분모가 아닙니다. kind: "sector"(업종, 기본) / "theme"(테마) code: 6자리 종목코드. 주면 업종을 자동 판정합니다.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeNo
kindNo
top_nNo
sector_nameNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changedv1.1.3
    • removedInput schema / properties / code / default
      Removed value: -""
    • removedInput schema / properties / kind / default
      Removed value: -"sector"
    • removedInput schema / properties / sector_name / default
      Removed value: -""
    • removedInput schema / properties / top_n / default
      Removed value: -40
  2. Addedv1.0.1

TDQS

A5/5.0
Behavior5/5

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

Annotations already declare readOnlyHint, openWorldHint, idempotentHint, and destructiveHint=false, so the description correctly avoids repeating those. It adds substantial behavioral context beyond annotations: the median is used instead of mean (with rationale), negative PER values are excluded from aggregation (with count noted), sample_median is used when the sector exceeds the aggregation cap, and top_n only affects the display table, not the aggregation denominator. These are non-obvious behaviors that materially affect how results should be interpreted. No contradiction with annotations.

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 organized into clear sections: purpose, usage examples, statistical methodology, aggregation behavior, and parameter explanations. It uses bold and bullet-like formatting to front-load key facts (median, exclusions, code shortcut) and includes concrete examples. While it is long, every sentence earns its place – no fluff or redundancy. The structure makes it easy for an agent to extract the critical information quickly.

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

Completeness5/5

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

Given the tool's complexity (aggregation logic, edge cases, multiple usage modes), the description is comprehensive. It covers the statistical basis (median), exclusions (negative PER), fallback behavior (sample_median), the role of top_n, and the code-based alternative. Since an output schema exists, the description need not explain the return format. There are no missing pieces that would prevent correct invocation or interpretation.

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

Parameters5/5

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

Schema description coverage is 0%, so the description bears full responsibility for parameter documentation. It explains each of the four parameters in detail: sector_name (with examples and the condition that it can be omitted if code is given), top_n (default 40, max 80, display-only), kind (sector vs theme), and code (6-digit code that auto-detects the sector). It also clarifies the relationship between parameters (code overrides sector_name) and the effect of top_n. This fully compensates for the bare schema.

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

Purpose5/5

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

The description clearly states the tool aggregates PER, PBR, and ROE for a sector/theme and shows a stock's relative position (premium/discount). It gives concrete example queries and explicitly differentiates from get_financial by noting it provides a comparison baseline that individual stock metrics cannot. The verb (get) and resource (sector valuation) are specific and unambiguous.

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

Usage Guidelines5/5

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

It explicitly states when to use this tool: for questions like 'average PER of a sector' or 'is this stock cheap within its sector?' It also says get_financial cannot answer these, routing the agent away from the sibling. It provides two usage modes (by sector name or by stock code) and a caveat about ETF/ETN not having sectors. This is clear guidance with an explicit alternative.

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