Skip to main content
Glama
debtstack-ai

DebtStack MCP Server

search_pricing

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

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

  • The MCP call_tool handler for 'search_pricing'. It passes arguments (ticker, cusip, min_ytm, limit) to GET /bonds with has_pricing=true, then formats bond pricing results (price, YTM, spread).
    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)]
  • MCP tool registration with input schema defining the tool's parameters: ticker, cusip, min_ytm, and limit.
    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": []
        }
  • Langchain API wrapper method that sets has_pricing=True and calls GET /bonds.
    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)
  • The core async SDK implementation of search_pricing, building params with has_pricing=true and calling GET /bonds with various optional filters.
    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()
  • Pydantic input schema for the Langchain SearchPricing tool, defining the accepted parameters and their types.
    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"
        )
Behavior2/5

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

No annotations provided, so description carries full burden. Only states it returns pricing data; no mention of real-time vs. historical, rate limits, or idempotency. Lacks depth for a read operation.

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?

Two sentences conveying source, return values, and use cases. No redundancy, front-loaded with key action and data source.

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?

Explains return fields despite no output schema. All parameters are documented. Lacks details on sorting, multiple ticker handling, or limitations, but sufficient for a straightforward search tool.

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

Parameters4/5

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

Schema coverage is 100% for all 4 parameters. The description adds context on output fields (price, YTM, spread) which helps interpret min_ytm. Slightly above baseline 3.

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?

Clearly states the tool retrieves bond pricing from FINRA TRACE, returns specific fields (price, YTM, spread), and provides use cases. Distinct from sibling tools like search_bonds.

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?

Provides two use cases ('find distressed bonds' and 'compare relative value') but does not mention when not to use or contrast with alternatives like search_bonds. Relies on implied context.

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