Skip to main content
Glama
adrielisa

MCP Server: Weather & Upnify Integration

by adrielisa

create-upnify-prospect

Add new prospects to Upnify CRM by inputting their name, email, and other details, facilitating streamlined CRM management within weather-integrated workflows.

Instructions

Create a new prospect in Upnify CRM

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
apellidosNoLast name of the prospect
calleNoStreet address
ciudadNoCity
codigoPostalNoPostal code
coloniaNoNeighborhood/Colony
comentariosNoAdditional comments about the prospect
correoYesEmail address of the prospect
empresaNoCompany name
idPaisNoCountry code (e.g., MX, US)MX
movilNoMobile phone number
nombreYesFirst name of the prospect
puestoNoJob position
sexoNoGender (H for male, M for female)
telefonoNoPhone number

Implementation Reference

  • Python implementation of the create-upnify-prospect tool handler. Validates input, prepares payload, authenticates, and sends POST request to Upnify API to create a prospect.
    async def create_prospect(self, data: Dict[str, Any]) -> Dict[str, Any]:
        """Create a new prospect in Upnify"""
        auth_info = await self.auth.get_token_and_user_info()
        token = auth_info["token"]
        
        # Validate required fields
        if not data.get("nombre") or not data.get("correo"):
            raise ValueError("Los campos 'nombre' y 'correo' son obligatorios")
        
        # Prepare prospect data
        prospect_data = {
            "nombre": data["nombre"],
            "apellidos": data.get("apellidos", ""),
            "correo": data["correo"],
            "telefono": data.get("telefono", ""),
            "movil": data.get("movil", ""),
            "sexo": data.get("sexo", "H"),
            "puesto": data.get("puesto", ""),
            "empresa": data.get("empresa", ""),
            "ciudad": data.get("ciudad", ""),
            "idPais": data.get("idPais", DEFAULTS["DEFAULT_COUNTRY"]),
            "calle": data.get("calle", ""),
            "colonia": data.get("colonia", ""),
            "codigoPostal": data.get("codigoPostal", ""),
            "comentarios": data.get("comentarios", "")
        }
        
        async with httpx.AsyncClient() as client:
            try:
                response = await client.post(
                    f"{API_URLS['UPNIFY_BASE']}{ENDPOINTS['CREATE_PROSPECT']}",
                    headers={
                        "token": token,
                        "Content-Type": "application/json"
                    },
                    json=prospect_data
                )
                
                if not response.is_success:
                    error_text = response.text
                    raise Exception(f"Error al crear prospecto: {response.status_code} {response.reason_phrase}. {error_text}")
                
                result = response.json()
                return {
                    "success": True,
                    "message": "Prospecto creado exitosamente",
                    "data": result
                }
                
            except Exception as error:
                return {
                    "success": False,
                    "error": f"Error al crear prospecto en Upnify: {str(error)}"
                }
  • TypeScript implementation of the create-upnify-prospect tool handler. Maps input data to Upnify payload, fetches prospect phases, authenticates, and sends POST request to create prospect.
    async createProspect(tkIntegracion: string, prospectData: ProspectData) {
        try {
            const { token, userInfo } = await this.auth.getTokenAndUserInfo(tkIntegracion);
    
            // Obtener el catálogo de fases para prospectos
            let tkFase = UPNIFY_DEFAULTS.TK_FASE;
            try {
                const phases = await this.auth.getProspectPhases(tkIntegracion);
                if (phases && phases.length > 0) {
                    tkFase = phases[0].tkFase;
                }
            } catch (phaseError) {
                // Usar fallback si no se pueden obtener las fases
                console.error('No se pudieron obtener las fases, usando fallback:', phaseError);
            }
    
            const upnifyPayload = {
                choice_empresa: "",
                search_terms: "",
                empresa: prospectData.empresa || "",
                tkEmpresa: "",
                cp: {
                    estatus: "",
                    validador: "",
                    division: "",
                    tipo: "",
                    gasto: "",
                    periodo: "",
                    tipoDeServicio: "",
                    testFecha: ""
                },
                nombre: prospectData.nombre || "",
                apellidos: prospectData.apellidos || "",
                titulo: "",
                sexo: prospectData.sexo || DEFAULTS.GENDER,
                correo: prospectData.correo || "",
                url: "",
                telefono2LadaPais: DEFAULTS.PHONE_PREFIX,
                telefono2: prospectData.telefono || "",
                movilLadaPais: DEFAULTS.PHONE_PREFIX,
                movil: prospectData.movil || "",
                puesto: prospectData.puesto || "",
                calle: prospectData.calle || "",
                colonia: prospectData.colonia || "",
                idPais: prospectData.idPais || DEFAULTS.COUNTRY,
                idEstado: "",
                idMunicipio: "",
                ciudad: prospectData.ciudad || "",
                codigoPostal: prospectData.codigoPostal || "",
                tkFase: tkFase,
                tkOrigen: "",
                facebook: "",
                twitter: "",
                skype: "",
                linkedIn: "",
                googlePlus: "",
                etiquetas: "",
                tkEtiquetas: ""
            };
    
            const response = await fetch(`${API_URLS.UPNIFY_BASE}${ENDPOINTS.PROSPECTS}`, {
                method: 'POST',
                headers: {
                    'token': token,
                    'Content-Type': 'application/json',
                },
                body: JSON.stringify(upnifyPayload)
            });
    
            if (!response.ok) {
                const errorText = await response.text();
                console.error('Payload enviado:', JSON.stringify(upnifyPayload, null, 2));
                console.error('Token usado:', token);
                console.error('Respuesta del servidor:', errorText);
                throw new Error(`Error al crear prospecto: ${response.status} ${response.statusText}. ${errorText}`);
            }
    
            const result = await response.text();
            return {
                success: true,
                message: 'Prospecto creado exitosamente',
                response: result,
                tkEmpresa: userInfo.tkEmpresa
            };
        } catch (error) {
            throw new Error(`Error al crear prospecto en Upnify: ${error instanceof Error ? error.message : error}`);
        }
    }
  • Input schema definition for the create-upnify-prospect tool in Python MCP server.
    Tool(
        name="create-upnify-prospect",
        description="Create a new prospect in Upnify CRM",
        inputSchema={
            "type": "object",
            "properties": {
                "nombre": {"type": "string", "description": "First name of the prospect"},
                "apellidos": {"type": "string", "description": "Last name of the prospect"},
                "correo": {"type": "string", "description": "Email address of the prospect"},
                "telefono": {"type": "string", "description": "Phone number"},
                "movil": {"type": "string", "description": "Mobile phone number"},
                "sexo": {"type": "string", "description": "Gender (H for male, M for female)", "enum": ["H", "M"]},
                "puesto": {"type": "string", "description": "Job position"},
                "empresa": {"type": "string", "description": "Company name"},
                "ciudad": {"type": "string", "description": "City"},
                "idPais": {"type": "string", "description": "Country code (e.g., MX, US)", "default": "MX"},
                "calle": {"type": "string", "description": "Street address"},
                "colonia": {"type": "string", "description": "Neighborhood/Colony"},
                "codigoPostal": {"type": "string", "description": "Postal code"},
                "comentarios": {"type": "string", "description": "Additional comments about the prospect"}
            },
            "required": ["nombre", "correo"]
        }
    ),
  • Input schema definition for the create-upnify-prospect tool in TypeScript MCP server.
        name: 'create-upnify-prospect',
        description: 'Create a new prospect in Upnify CRM',
        inputSchema: {
            type: 'object',
            properties: {
                nombre: {
                    type: 'string',
                    description: 'First name of the prospect'
                },
                apellidos: {
                    type: 'string',
                    description: 'Last name of the prospect'
                },
                correo: {
                    type: 'string',
                    description: 'Email address of the prospect'
                },
                telefono: {
                    type: 'string',
                    description: 'Phone number'
                },
                movil: {
                    type: 'string',
                    description: 'Mobile phone number'
                },
                sexo: {
                    type: 'string',
                    description: 'Gender (H for male, M for female)',
                    enum: ['H', 'M']
                },
                puesto: {
                    type: 'string',
                    description: 'Job position'
                },
                empresa: {
                    type: 'string',
                    description: 'Company name'
                },
                ciudad: {
                    type: 'string',
                    description: 'City'
                },
                idPais: {
                    type: 'string',
                    description: 'Country code (e.g., MX, US)',
                    default: 'MX'
                },
                calle: {
                    type: 'string',
                    description: 'Street address'
                },
                colonia: {
                    type: 'string',
                    description: 'Neighborhood/Colony'
                },
                codigoPostal: {
                    type: 'string',
                    description: 'Postal code'
                },
                comentarios: {
                    type: 'string',
                    description: 'Additional comments about the prospect'
                }
            },
            required: ['nombre', 'correo']
        }
    },
  • Tool dispatch/registration in Python MCP server's call_tool handler.
    if name == "create-upnify-prospect":
        result = await prospects_handler.create_prospect(arguments)
        return [TextContent(type="text", text=str(result))]
Behavior2/5

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

With no annotations, the description carries full burden but only states it 'creates' without detailing behavioral traits. It lacks information on permissions needed, whether the operation is idempotent, what happens on duplicate emails, or the response format, leaving critical gaps for a mutation tool.

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 directly states the tool's purpose without unnecessary words. It's front-loaded with the core action, making it easy to parse quickly.

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?

For a mutation tool with 14 parameters, no annotations, and no output schema, the description is insufficient. It doesn't cover behavioral aspects like error handling, success indicators, or integration context, leaving the agent with significant uncertainty about how 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%, so the schema fully documents all 14 parameters. The description adds no additional parameter semantics beyond implying prospect creation, which aligns with the schema but doesn't provide extra value like usage examples or constraints.

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 ('Create a new prospect') and resource ('in Upnify CRM'), making the purpose unambiguous. It distinguishes from siblings like 'create-upnify-opportunity' by specifying the prospect entity, though it doesn't explicitly contrast them.

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?

No guidance is provided on when to use this tool versus alternatives. While it's implied for prospect creation, there's no mention of prerequisites, dependencies, or when to choose this over similar tools like 'search-upnify-contacts' for existing records.

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