Skip to main content
Glama
lolifamily

ashare-mcp

calculate_peg_ratio

Calculates PEG ratio for A-share stocks using current PE and latest YoY net profit growth, handling cases where earnings are negative or growth data is unavailable.

Instructions

Calculate PEG = current PE_TTM / G, with G the latest published YoY net profit growth.

PE is the latest available quote; G is the most recently disclosed YoY growth, returned as growth_period (statDate) and growth_period_type (Q1/H1/9M/FY). baostock's YOYNI is a ratio (0.1858 = +18.58% YoY); PEG uses the percent number (18.58).

PEG is undefined and returns peg=None when:

  • PE == 0 (no TTM earnings data: index / non-equity, not loss-making)

  • PE < 0 (loss-making company; PE has no valuation meaning)

  • no growth report has been published yet (fresh IPO / data delay)

  • YoY growth <= 0 (PEG is a growth-stock metric; declining earnings yield a negative or nonsensical value that LLMs would misread as cheap)

Args: code: Stock code.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYes
Behavior4/5

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

With no annotations, the description clearly explains data sources, unit conversions (YOYNI ratio vs percent), and return values (peg=None under conditions), though could be more explicit about output structure.

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

Conciseness4/5

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

Well-structured with formula, explanation, and args section; no fluff, though slightly lengthy.

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

Completeness3/5

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

Covers key aspects like undefined conditions and output fields (growth_period, growth_period_type) but lacks explicit return structure without an output schema.

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

Parameters2/5

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

The single parameter 'code' is described only as 'Stock code' with no format details, adding minimal value beyond the schema's type and name.

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 states the formula for PEG and specifies the inputs (PE_TTM, YoY growth), making the purpose clear and distinct from sibling tools like DCF or DDM valuation.

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

Usage Guidelines4/5

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

Provides extensive conditions when PEG is undefined (PE==0, PE<0, no growth report, growth<=0) with reasoning, but does not explicitly compare to alternative valuation tools for when to use PEG vs others.

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/lolifamily/ashare-mcp'

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