Skip to main content
Glama
ismaeldosil

FinaShopping MCP Server

by ismaeldosil

compare-loans

Compare multiple loan options side by side to evaluate terms, rates, and payments for informed financial decisions.

Instructions

Compare multiple loans side by side. Useful for choosing the best option. | Comparar múltiples préstamos lado a lado. Útil para elegir la mejor opción.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
loanIdsYesLoan IDs to compare | IDs de préstamos a comparar

Implementation Reference

  • Handler function that takes loanIds, fetches all loans using getLoans(), selects specified loans, checks for at least 2, computes comparison data including totalCost, finds best by lowest rate/payment and highest approval probability, returns JSON with comparison table and recommendations.
    async ({ loanIds }) => {
      const loans = await getLoans();
      const selectedLoans = loans.filter(loan => loanIds.includes(loan.id));
    
      if (selectedLoans.length < 2) {
        return {
          content: [{
            type: 'text' as const,
            text: JSON.stringify({
              error: 'At least 2 valid loans are required for comparison | Se necesitan al menos 2 préstamos válidos para comparar',
              validIds: loans.map(l => l.id)
            })
          }],
          isError: true
        };
      }
    
      const comparison = selectedLoans.map(loan => ({
        id: loan.id,
        name: loan.name,
        institution: loan.institution,
        amount: loan.amount,
        currency: loan.currency,
        rate: loan.rate,
        term: loan.term,
        monthlyPayment: loan.monthlyPayment,
        totalCost: loan.monthlyPayment * loan.term,
        probability: loan.probability
      }));
    
      // Find best options
      const lowestRate = comparison.reduce((min, l) => l.rate < min.rate ? l : min);
      const lowestPayment = comparison.reduce((min, l) => l.monthlyPayment < min.monthlyPayment ? l : min);
      const highestProbability = comparison.find(l => l.probability === 'alta') || comparison[0];
    
      return {
        content: [{
          type: 'text' as const,
          text: JSON.stringify({
            comparison,
            recommendations: {
              lowestRate: { id: lowestRate.id, name: lowestRate.name, rate: lowestRate.rate },
              lowestPayment: { id: lowestPayment.id, name: lowestPayment.name, payment: lowestPayment.monthlyPayment },
              highestApproval: { id: highestProbability.id, name: highestProbability.name, probability: highestProbability.probability }
            }
          }, null, 2)
        }]
      };
    }
  • Zod input schema requiring an array of 2 to 5 numeric loan IDs.
    {
      loanIds: z.array(z.number()).min(2).max(5).describe('Loan IDs to compare | IDs de préstamos a comparar')
    },
  • Direct registration of the compare-loans tool using server.tool(), including description, schema, and inline handler.
    // Tool: compare-loans
    server.tool(
      'compare-loans',
      'Compare multiple loans side by side. Useful for choosing the best option. | Comparar múltiples préstamos lado a lado. Útil para elegir la mejor opción.',
      {
        loanIds: z.array(z.number()).min(2).max(5).describe('Loan IDs to compare | IDs de préstamos a comparar')
      },
      async ({ loanIds }) => {
        const loans = await getLoans();
        const selectedLoans = loans.filter(loan => loanIds.includes(loan.id));
    
        if (selectedLoans.length < 2) {
          return {
            content: [{
              type: 'text' as const,
              text: JSON.stringify({
                error: 'At least 2 valid loans are required for comparison | Se necesitan al menos 2 préstamos válidos para comparar',
                validIds: loans.map(l => l.id)
              })
            }],
            isError: true
          };
        }
    
        const comparison = selectedLoans.map(loan => ({
          id: loan.id,
          name: loan.name,
          institution: loan.institution,
          amount: loan.amount,
          currency: loan.currency,
          rate: loan.rate,
          term: loan.term,
          monthlyPayment: loan.monthlyPayment,
          totalCost: loan.monthlyPayment * loan.term,
          probability: loan.probability
        }));
    
        // Find best options
        const lowestRate = comparison.reduce((min, l) => l.rate < min.rate ? l : min);
        const lowestPayment = comparison.reduce((min, l) => l.monthlyPayment < min.monthlyPayment ? l : min);
        const highestProbability = comparison.find(l => l.probability === 'alta') || comparison[0];
    
        return {
          content: [{
            type: 'text' as const,
            text: JSON.stringify({
              comparison,
              recommendations: {
                lowestRate: { id: lowestRate.id, name: lowestRate.name, rate: lowestRate.rate },
                lowestPayment: { id: lowestPayment.id, name: lowestPayment.name, payment: lowestPayment.monthlyPayment },
                highestApproval: { id: highestProbability.id, name: highestProbability.name, probability: highestProbability.probability }
              }
            }, null, 2)
          }]
        };
      }
    );
  • src/tools/index.ts:7-7 (registration)
    Top-level registration invocation within registerAllTools that calls registerLoanTools(server), thereby registering the compare-loans tool.
    registerLoanTools(server);
  • Helper function to fetch and return the list of available loans from the API, used by the compare-loans handler.
    async function getLoans(): Promise<Loan[]> {
      const response = await fetchLoans();
      return response.loans;
    }
Behavior2/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 of behavioral disclosure. It states the tool compares loans but doesn't describe what the comparison includes (e.g., interest rates, terms), how results are presented, whether it's read-only or has side effects, or any limitations like rate limits. For a tool with no annotations, this leaves significant behavioral gaps.

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?

The description is concise and front-loaded, with the core purpose stated first in a single sentence. The bilingual format (English and Spanish) adds redundancy but doesn't significantly detract from clarity. Every sentence earns its place by reinforcing the tool's utility, though it could be more structured for AI consumption.

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

Completeness2/5

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

Given the tool's complexity (comparing multiple loans) and lack of annotations and output schema, the description is incomplete. It doesn't explain what the comparison outputs (e.g., side-by-side table, summary metrics) or behavioral traits like error handling. For a comparison tool with no structured output documentation, this leaves the agent with insufficient context.

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?

The description adds no parameter-specific information beyond what the schema provides. The schema has 100% description coverage, documenting that 'loanIds' is an array of numbers with min/max items. Since the schema does the heavy lifting, the baseline score is 3, as the description doesn't compensate with additional semantics like format examples or usage context.

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: 'Compare multiple loans side by side' specifies the verb (compare) and resource (loans). It distinguishes from siblings like 'search-loans' or 'get-loan-requirements' by focusing on comparison rather than searching or fetching requirements. However, it doesn't explicitly differentiate from all siblings (e.g., 'calculate-loan-payment' is also loan-related but for calculations).

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 provides implied usage guidance: 'Useful for choosing the best option' suggests it should be used when evaluating loan alternatives. It doesn't explicitly state when to use this tool versus alternatives like 'search-loans' or 'calculate-loan-payment', nor does it mention exclusions or prerequisites. The guidance is helpful but not comprehensive.

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/ismaeldosil/finashopping-mcp'

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