Skip to main content
Glama
wspotter

MCP Art Supply Store

by wspotter

update_loyalty_points

Add or redeem customer loyalty points based on store spending - earn 1 point per $1 spent, redeem 100 points for $10 off purchases.

Instructions

Add or redeem loyalty points for a customer. Store policy: 1 point per $1 spent, 100 points = $10 off.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
customerIdYesCustomer ID
pointsYesPoints to add (positive) or redeem (negative)
reasonYesReason for point adjustment

Implementation Reference

  • The handler function for the 'update_loyalty_points' tool. It retrieves the customer by ID from the mock store data, updates their loyalty points by adding the specified amount, handles the case where the customer is not found, and returns a formatted confirmation message with the old and new point balances.
    case 'update_loyalty_points': {
      const customerId = String(args?.customerId || '');
      const points = Number(args?.points || 0);
      const reason = String(args?.reason || 'adjustment');
      const customer = storeData.customers.find(c => c.id === customerId);
      
      if (!customer) {
        return { content: [{ type: 'text', text: `❌ Customer ${customerId} not found` }] };
      }
      
      const oldPoints = customer.loyaltyPoints;
      customer.loyaltyPoints += points;
      
      return {
        content: [{
          type: 'text',
          text: `✅ Loyalty points updated for ${customer.name}\n- Previous: ${oldPoints} points\n- Change: ${points > 0 ? '+' : ''}${points} points\n- New Balance: ${customer.loyaltyPoints} points (≈ $${(customer.loyaltyPoints / 10).toFixed(2)} credit)\n- Reason: ${reason}`
        }]
      };
    }
  • The input schema definition for the 'update_loyalty_points' tool, specifying required parameters: customerId (string), points (number, positive to add, negative to redeem), and reason (string).
    {
      name: 'update_loyalty_points',
      description: 'Add or redeem loyalty points for a customer. Store policy: 1 point per $1 spent, 100 points = $10 off.',
      inputSchema: {
        type: 'object',
        properties: {
          customerId: { type: 'string', description: 'Customer ID' },
          points: { type: 'number', description: 'Points to add (positive) or redeem (negative)' },
          reason: { type: 'string', description: 'Reason for point adjustment' },
        },
        required: ['customerId', 'points', 'reason'],
      },
    },
  • src/index.ts:516-518 (registration)
    Registration of the tool list handler. The 'update_loyalty_points' tool is included in the 'tools' array returned by this handler, making it discoverable via the MCP ListTools request. This is where all tools, including this one, are registered for listing.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return { tools };
    });
  • src/index.ts:520-521 (registration)
    Registration of the general tool call handler via CallToolRequestSchema. The specific logic for 'update_loyalty_points' is handled in the switch statement within this handler function.
    // Handle tool calls
    server.setRequestHandler(CallToolRequestSchema, async (request) => {
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. It mentions the store policy (1 point per $1 spent, 100 points = $10 off), which adds useful context about point valuation, but it does not disclose critical behavioral traits such as permission requirements, whether changes are reversible, rate limits, or what happens on redemption failure. For a mutation tool with zero annotation coverage, this is a significant gap.

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 front-loaded with the core purpose in the first sentence and efficiently adds policy details in the second. Both sentences earn their place by providing essential context without redundancy, making it appropriately sized and well-structured for quick understanding.

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 the tool's complexity (a mutation with 3 parameters), no annotations, and no output schema, the description is moderately complete. It covers the purpose and policy but lacks details on behavioral aspects like error handling or return values. It compensates somewhat with parameter clarification but falls short of being fully comprehensive for safe agent use.

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 three parameters (customerId, points, reason) adequately. The description adds some value by explaining that positive points mean 'add' and negative points mean 'redeem', which clarifies the 'points' parameter semantics beyond the schema's basic description. However, it does not provide additional details on parameter formats or constraints, meeting the baseline for high schema coverage.

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 specific action ('Add or redeem loyalty points') and the target resource ('for a customer'), distinguishing it from all sibling tools which handle different business functions like inventory, sales, or social media. It provides concrete details about the store policy, making the purpose unambiguous and well-defined.

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 implies usage through the store policy context (e.g., points tied to spending), but it does not explicitly state when to use this tool versus alternatives like 'calculate_discount' or 'lookup_customer'. No exclusions or prerequisites are mentioned, leaving some ambiguity about appropriate scenarios.

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/wspotter/mcpart'

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