Skip to main content
Glama
adrielisa

MCP Server: Weather & Upnify Integration

by adrielisa

get-upnify-pending-payments

Retrieve pending payments data from Upnify by grouping records and selecting specific time periods. Customize grouping by executive, industry, region, or other criteria, and define reporting frequency for streamlined insights.

Instructions

Get pending payments report from Upnify with customizable grouping and period options

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
agrupacionYesGroup by: 1=Executive, 2=Group, 3=Line, 17=Industry, 4=Origin, 5=Country, 6=Region
periodicidadYesPeriod: 4=Monthly, 3=Bimonthly, 2=Quarterly, 1=Semiannual, 5=Biweekly, 6=Weekly

Implementation Reference

  • Core handler function that authenticates, constructs the API URL with grouping and periodicity parameters, fetches the pending payments data from Upnify, and returns formatted response with total count.
    async getPendingPayments(tkIntegracion: string, reportParams: Pick<ReportParams, 'agrupacion' | 'periodicidad'>) {
        try {
            const { token, userInfo } = await this.auth.getTokenAndUserInfo(tkIntegracion);
    
            // Construir URL con parámetros de query para cobros pendientes
            const queryParams = new URLSearchParams({
                agrupacion: reportParams.agrupacion.toString(),
                periodicidad: reportParams.periodicidad.toString()
            });
    
            const response = await fetch(`${API_URLS.UPNIFY_BASE}${ENDPOINTS.REPORTS.PENDING_PAYMENTS}?${queryParams}`, {
                method: 'GET',
                headers: {
                    'token': token,
                    'Content-Type': 'application/json',
                    'User-Agent': 'UpnifyMCP/1.0'
                }
            });
    
            if (!response.ok) {
                const errorText = await response.text();
                console.error('Parámetros enviados:', reportParams);
                console.error('Token usado:', token);
                console.error('Respuesta del servidor:', errorText);
                throw new Error(`Error al obtener cobros pendientes: ${response.status} ${response.statusText}. ${errorText}`);
            }
    
            const result = await response.json();
            return {
                success: true,
                message: 'Cobros pendientes obtenidos exitosamente',
                data: result,
                parameters: reportParams,
                total: result.length || 0,
                tkEmpresa: userInfo.tkEmpresa
            };
        } catch (error) {
            throw new Error(`Error al obtener cobros pendientes de Upnify: ${error instanceof Error ? error.message : error}`);
        }
    }
  • Input schema definition specifying agrupacion and periodicidad parameters with enums, descriptions, defaults, and required fields for tool validation.
    {
        name: 'get-upnify-pending-payments',
        description: 'Get pending payments report from Upnify with customizable grouping and period options',
        inputSchema: {
            type: 'object',
            properties: {
                agrupacion: {
                    type: 'integer',
                    description: 'Group by: 1=Executive, 2=Group, 3=Line, 17=Industry, 4=Origin, 5=Country, 6=Region',
                    enum: [1, 2, 3, 17, 4, 5, 6],
                    default: 1
                },
                periodicidad: {
                    type: 'integer',
                    description: 'Period: 4=Monthly, 3=Bimonthly, 2=Quarterly, 1=Semiannual, 5=Biweekly, 6=Weekly',
                    enum: [1, 2, 3, 4, 5, 6],
                    default: 4
                }
            },
            required: ['agrupacion', 'periodicidad']
        }
    },
  • main.ts:350-372 (registration)
    Tool dispatch registration in CallToolRequestSchema handler that validates inputs, calls the reportsHandler.getPendingPayments, formats parameters, and constructs the MCP response.
    } else if (name === 'get-upnify-pending-payments') {
        const reportParams = args as any;
        if (!reportParams.agrupacion || !reportParams.periodicidad) {
            return createErrorResponse(
                new Error('Se requieren todos los parámetros: agrupacion, periodicidad'),
                'Validación de parámetros'
            );
        }
    
        try {
            const result = await reportsHandler.getPendingPayments(tkIntegracion, reportParams);
            const parametersDescription = formatPendingPaymentsParameters(reportParams);
    
            return createSuccessResponse({
                success: true,
                message: 'Cobros pendientes obtenidos exitosamente',
                parameters: parametersDescription,
                total: result.total,
                data: result.data
            });
        } catch (error) {
            return createErrorResponse(error, 'Error al obtener cobros pendientes de Upnify');
        }
  • Helper function to format agrupacion and periodicidad parameters into human-readable strings using predefined labels for display in responses.
    export function formatPendingPaymentsParameters(params: Pick<ReportParams, 'agrupacion' | 'periodicidad'>) {
        return {
            agrupacion: `${params.agrupacion} (${REPORT_LABELS.AGRUPACION[params.agrupacion as keyof typeof REPORT_LABELS.AGRUPACION] || 'Desconocido'})`,
            periodicidad: `${params.periodicidad} (${REPORT_LABELS.PERIODICIDAD[params.periodicidad as keyof typeof REPORT_LABELS.PERIODICIDAD] || 'Desconocido'})`
        };
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. While 'Get' implies a read operation, it doesn't specify whether this requires authentication, has rate limits, returns paginated results, or what format the report comes in. The mention of 'customizable grouping and period options' hints at configuration but doesn't explain behavioral implications.

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 a single, efficient sentence that communicates the core purpose without unnecessary words. It's appropriately sized for a tool with two well-documented parameters and gets straight to the point with zero wasted verbiage.

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?

For a read-only reporting tool with two well-documented parameters and no output schema, the description is minimally adequate. It identifies what the tool does but lacks important context about when to use it versus sibling tools and doesn't describe the report format or any behavioral constraints that would be important for an agent to use it effectively.

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% with both parameters fully documented in the schema itself. The description mentions 'customizable grouping and period options' which aligns with the schema parameters but adds no additional semantic context beyond what's already in the parameter descriptions. This meets the baseline for high schema coverage.

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 action ('Get pending payments report') and source ('from Upnify'), which is specific and unambiguous. However, it doesn't distinguish this tool from its sibling tools like 'get-upnify-activity-report' or 'get-upnify-sales-report' beyond mentioning 'pending payments' - the distinction is implied but not explicit.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. With multiple sibling reporting tools (activity, conversion, sales reports), there's no indication of what makes 'pending payments report' distinct or when it's the appropriate choice over other reporting tools.

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

Related 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/adrielisa/MCP'

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