Skip to main content
Glama
debtstack-ai

DebtStack MCP Server

search_pricing

Retrieve current bond pricing data from FINRA TRACE to identify distressed bonds or compare relative value by analyzing yield, spread, and price information.

Instructions

Get bond pricing from FINRA TRACE. Returns current price, yield to maturity, and spread to treasury. Use to find distressed bonds or compare relative value.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tickerNoCompany ticker(s)
cusipNoBond CUSIP(s)
min_ytmNoMinimum yield to maturity (%)
limitNoMaximum results (default 10)

Implementation Reference

  • MCP server handler for search_pricing tool - processes arguments, calls API with has_pricing=true, and formats bond pricing results with price, YTM, and spread information
    elif name == "search_pricing":
        params = {k: v for k, v in arguments.items() if v is not None}
        params.setdefault("limit", 10)
        params["has_pricing"] = True
        result = api_get("/bonds", params)
    
        bonds = result.get("data", [])
        if not bonds:
            return [TextContent(type="text", text="No pricing data found.")]
    
        text = f"Bond pricing ({len(bonds)} bonds):\n\n"
        for b in bonds:
            text += f"**{b.get('name', b.get('cusip', '?'))}**\n"
            if b.get('company_ticker'):
                text += f"Issuer: {b['company_ticker']}\n"
            pricing = b.get('pricing', {}) or {}
            if pricing.get('last_price'):
                text += f"Price: {pricing['last_price']:.2f}\n"
            if pricing.get('ytm'):
                text += f"YTM: {pricing['ytm']:.2f}%\n"
            if pricing.get('spread'):
                text += f"Spread: {pricing['spread']} bps\n"
            text += "\n"
    
        return [TextContent(type="text", text=text)]
  • Core async implementation of search_pricing - makes GET request to /bonds endpoint with has_pricing=true, supports filtering by ticker, cusip, min_ytm, max_ytm, min_spread, and custom fields/sort
    async def search_pricing(
        self,
        ticker: Optional[str] = None,
        cusip: Optional[str] = None,
        min_ytm: Optional[float] = None,
        max_ytm: Optional[float] = None,
        min_spread: Optional[int] = None,
        fields: Optional[str] = None,
        sort: str = "-pricing.ytm",
        limit: int = 50,
    ) -> Dict[str, Any]:
        """
        Search bond pricing from FINRA TRACE.
    
        Uses /bonds endpoint with has_pricing=true. Pricing is included
        inline with each bond result.
    
        Args:
            ticker: Company ticker(s)
            cusip: CUSIP(s)
            min_ytm: Minimum YTM (%)
            max_ytm: Maximum YTM (%)
            min_spread: Minimum spread (bps)
            fields: Comma-separated fields to return (pricing fields always included)
            sort: Sort field (default: -pricing.ytm for highest yield first)
            limit: Results per page
    
        Returns:
            Dictionary with bond data including inline pricing
    
        Example:
            # Get current pricing for RIG bonds
            result = await client.search_pricing(
                ticker="RIG",
                fields="name,cusip,pricing"
            )
        """
        params = {
            "has_pricing": True,
            "sort": sort,
            "limit": limit,
        }
    
        if ticker:
            params["ticker"] = ticker
        if cusip:
            params["cusip"] = cusip
        if min_ytm is not None:
            params["min_ytm"] = min_ytm
        if max_ytm is not None:
            params["max_ytm"] = max_ytm
        if min_spread is not None:
            params["min_spread"] = min_spread
        if fields:
            params["fields"] = fields
    
        client = await self._get_client()
        response = await client.get("/bonds", params=params)
        response.raise_for_status()
        return response.json()
  • MCP tool registration with name, description, and input schema defining optional ticker, cusip, min_ytm, and limit parameters
    Tool(
        name="search_pricing",
        description=(
            "Get bond pricing from FINRA TRACE. "
            "Returns current price, yield to maturity, and spread to treasury. "
            "Use to find distressed bonds or compare relative value."
        ),
        inputSchema={
            "type": "object",
            "properties": {
                "ticker": {
                    "type": "string",
                    "description": "Company ticker(s)"
                },
                "cusip": {
                    "type": "string",
                    "description": "Bond CUSIP(s)"
                },
                "min_ytm": {
                    "type": "number",
                    "description": "Minimum yield to maturity (%)"
                },
                "limit": {
                    "type": "integer",
                    "description": "Maximum results (default 10)"
                }
            },
            "required": []
        }
    ),
  • Pydantic BaseModel schema for LangChain tool input - SearchPricingInput with optional ticker, cusip, min_ytm, fields and default limit of 10
    class SearchPricingInput(BaseModel):
        """Input for pricing search tool."""
        ticker: Optional[str] = Field(
            None,
            description="Company ticker(s) to filter by"
        )
        cusip: Optional[str] = Field(
            None,
            description="CUSIP(s) to look up"
        )
        min_ytm: Optional[float] = Field(
            None,
            description="Minimum yield to maturity (%)"
        )
        fields: Optional[str] = Field(
            None,
            description="Comma-separated fields to return"
        )
        limit: int = Field(
            10,
            description="Maximum results to return"
        )
  • Helper method in DebtStackAPIWrapper that adds has_pricing=True to kwargs and calls /bonds endpoint
    def search_pricing(self, **kwargs) -> Dict[str, Any]:
        """Search bond pricing via /bonds with has_pricing=true."""
        kwargs["has_pricing"] = True
        return self._get("/bonds", params=kwargs)
Behavior3/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. It discloses that the tool retrieves data from FINRA TRACE and returns specific financial metrics, but lacks details on rate limits, authentication needs, error handling, or data freshness. For a financial data tool with no annotations, this is a moderate gap in behavioral context.

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 two sentences, front-loaded with the core purpose and followed by usage guidance. Every sentence adds value without redundancy, making it efficient and well-structured for quick comprehension.

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?

Given no annotations and no output schema, the description provides purpose and usage but lacks details on return format (e.g., structure of pricing data), error cases, or dependencies. For a 4-parameter tool with moderate complexity in financial data retrieval, this is adequate but leaves gaps in full contextual understanding.

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%, so the schema already documents all parameters (ticker, cusip, min_ytm, limit). The description does not add any parameter-specific details beyond what the schema provides, such as examples or constraints on ticker/cusip formats. Baseline 3 is appropriate when the schema handles parameter documentation.

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's purpose with specific verbs ('Get bond pricing from FINRA TRACE') and resources ('bond pricing'), and distinguishes it from siblings by specifying it returns 'current price, yield to maturity, and spread to treasury' for bond valuation, unlike other tools that handle corporate structure, documents, or bond resolution.

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?

The description explicitly states when to use this tool: 'Use to find distressed bonds or compare relative value.' This provides clear context for its application, distinguishing it from alternatives like 'search_bonds' (which might be more general) or 'resolve_bond' (which likely identifies bonds).

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/debtstack-ai/debtstack-python'

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