Skip to main content
Glama
adrielisa

MCP Server: Weather & Upnify Integration

by adrielisa

get-upnify-sales-report

Generate customized sales reports from Upnify by specifying grouping, period, year, and tax options for detailed analysis and insights.

Instructions

Get sales report from Upnify with customizable grouping, period, year and tax options

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
agrupacionYesGroup by: 1=Executive, 2=Group, 3=Line, 17=Industry, 4=Origin, 5=Country, 6=Region
anioYesYear (2009-2025)
impuestosYesTaxes: 0=Exclude, 1=Include
periodicidadYesPeriod: 4=Monthly, 3=Bimonthly, 2=Quarterly, 1=Semiannual, 5=Biweekly, 6=Weekly

Implementation Reference

  • The main handler function that authenticates with Upnify, constructs the API query parameters, fetches the sales report from the Upnify API endpoint, and returns the formatted response.
    async getSalesReport(tkIntegracion: string, reportParams: ReportParams) {
        try {
            const { token, userInfo } = await this.auth.getTokenAndUserInfo(tkIntegracion);
    
            // Construir URL con parámetros de query
            const queryParams = new URLSearchParams({
                agrupacion: reportParams.agrupacion.toString(),
                periodicidad: reportParams.periodicidad.toString(),
                anio: reportParams.anio!.toString(),
                impuestos: reportParams.impuestos!.toString()
            });
    
            const response = await fetch(`${API_URLS.UPNIFY_BASE}${ENDPOINTS.REPORTS.SALES}?${queryParams}`, {
                method: 'GET',
                headers: {
                    'token': token,
                    'Content-Type': 'application/json',
                }
            });
    
            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 reporte de ventas: ${response.status} ${response.statusText}. ${errorText}`);
            }
    
            const result = await response.json();
            return {
                success: true,
                message: 'Reporte de ventas obtenido exitosamente',
                data: result,
                parameters: reportParams,
                tkEmpresa: userInfo.tkEmpresa
            };
        } catch (error) {
            throw new Error(`Error al obtener reporte de ventas de Upnify: ${error instanceof Error ? error.message : error}`);
        }
    }
  • MCP tool input schema defining parameters for grouping, periodicity, year, and taxes inclusion with enums, defaults, and required fields.
    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: 17
            },
            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: 6
            },
            anio: {
                type: 'integer',
                description: 'Year (2009-2025)',
                minimum: 2009,
                maximum: 2025,
                default: 2025
            },
            impuestos: {
                type: 'integer',
                description: 'Taxes: 0=Exclude, 1=Include',
                enum: [0, 1],
                default: 0
            }
        },
        required: ['agrupacion', 'periodicidad', 'anio', 'impuestos']
  • main.ts:327-348 (registration)
    Tool dispatch registration in the CallToolRequestSchema handler that validates parameters, calls the reportsHandler.getSalesReport, formats response, and handles errors.
    } else if (name === 'get-upnify-sales-report') {
        const reportParams = args as any;
        if (!validateReportParams(reportParams)) {
            return createErrorResponse(
                new Error('Se requieren todos los parámetros: agrupacion, periodicidad, anio, impuestos'),
                'Validación de parámetros'
            );
        }
    
        try {
            const result = await reportsHandler.getSalesReport(tkIntegracion, reportParams);
            const parametersDescription = formatReportParameters(reportParams);
    
            return createSuccessResponse({
                success: true,
                message: 'Reporte de ventas obtenido exitosamente',
                parameters: parametersDescription,
                data: result.data
            });
        } catch (error) {
            return createErrorResponse(error, 'Error al obtener reporte de ventas de Upnify');
        }
  • TypeScript interface defining the shape of ReportParams used in the handler for type safety.
    export interface ReportParams {
        agrupacion: number;
        periodicidad: number;
        anio?: number;
        impuestos?: number;
    }
  • Validation function ensuring all required report parameters are present before calling the handler.
    export function validateReportParams(params: any): params is ReportParams {
        return (
            params.agrupacion !== undefined &&
            params.periodicidad !== undefined &&
            params.anio !== undefined &&
            params.impuestos !== undefined
        );
    }
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. It mentions 'customizable grouping, period, year and tax options' which hints at configuration, but doesn't describe what the tool actually returns (e.g., format, structure, pagination), whether it's a read-only operation, potential rate limits, authentication requirements, or data freshness. For a reporting tool with zero annotation coverage, this is inadequate.

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 immediately communicates the core functionality. Every word earns its place—'Get sales report' establishes the action, 'from Upnify' specifies the source, and 'with customizable grouping, period, year and tax options' highlights key parameters without redundancy.

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 (4 required parameters, no output schema, and no annotations), the description is insufficient. It doesn't explain what the report output looks like, how data is structured, whether there are limitations (e.g., date ranges, access permissions), or how it differs from sibling report tools. For a reporting tool with multiple configuration options, more context is needed.

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 detailed enum descriptions for all parameters. The description adds minimal value beyond the schema, only listing the four parameter categories without providing additional context about how they interact or affect the report output. This meets the baseline of 3 when schema coverage is high.

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 verb ('Get') and resource ('sales report from Upnify'), making the purpose immediately understandable. It distinguishes this tool from siblings like 'get-upnify-activity-report' or 'get-upnify-conversion-report' by specifying it's for sales data. However, it doesn't explicitly contrast with all siblings, such as 'search-upnify-contacts'.

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. It doesn't mention when this sales report is appropriate compared to other report tools (e.g., activity or conversion reports) or when to use search tools. There's no context about prerequisites, data freshness, or limitations.

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