Skip to main content
Glama
yanboishere

Infini Payment MCP Server

by yanboishere

verify_webhook_signature

Validate webhook authenticity from Infini Payment by checking signatures against provided body, timestamp, and secret to ensure secure transaction processing.

Instructions

Verify webhook signature from Infini.

Args:
    body: Raw webhook body string
    signature: Signature from webhook header
    timestamp: Timestamp from webhook header
    webhook_secret: Webhook secret (uses INFINI_SECRET_KEY if not provided)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bodyYes
signatureYes
timestampYes
webhook_secretNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function for the 'verify_webhook_signature' tool, registered via @mcp.tool() decorator. It verifies Infini webhook signatures by recomputing HMAC-SHA256 of timestamp + raw body using the secret and comparing it to the provided signature.
    @mcp.tool()
    def verify_webhook_signature(
        body: str,
        signature: str,
        timestamp: str,
        webhook_secret: Optional[str] = None
    ) -> str:
        """
        Verify webhook signature from Infini.
        
        Args:
            body: Raw webhook body string
            signature: Signature from webhook header
            timestamp: Timestamp from webhook header
            webhook_secret: Webhook secret (uses INFINI_SECRET_KEY if not provided)
        """
        if not webhook_secret:
            webhook_secret = INFINI_SECRET_KEY
        
        if not webhook_secret:
            return "Error: No webhook secret available"
        
        try:
            # Create signing string: timestamp + body
            signing_string = f"{timestamp}{body}"
            
            # Calculate expected signature
            expected_signature = base64.b64encode(
                hmac.new(
                    webhook_secret.encode(),
                    signing_string.encode(),
                    hashlib.sha256
                ).digest()
            ).decode()
            
            # Compare signatures
            if hmac.compare_digest(signature, expected_signature):
                return "Webhook signature verified successfully"
            else:
                return "Webhook signature verification failed"
                
        except Exception as e:
            return f"Error verifying webhook: {str(e)}"
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 describes what the tool does but lacks details on behavioral traits like error handling, performance, or side effects. For a verification tool with security implications, this is a significant gap in transparency.

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 appropriately sized and front-loaded, starting with the tool's purpose followed by a clear, bullet-like list of parameters with brief explanations. Every sentence adds value without redundancy, making it efficient and easy to parse.

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 that there is an output schema, the description doesn't need to explain return values. However, for a verification tool with no annotations and security relevance, it lacks context on error cases or operational details. The parameter explanations are helpful, but overall completeness is moderate due to missing behavioral insights.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds substantial meaning beyond the input schema, which has 0% schema description coverage. It explains each parameter's purpose and provides a default behavior for 'webhook_secret' ('uses INFINI_SECRET_KEY if not provided'), which is not evident from the schema alone. This compensates fully for the schema's lack of descriptions.

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: 'Verify webhook signature from Infini.' It specifies the verb ('verify') and resource ('webhook signature'), making the function unambiguous. However, it doesn't explicitly differentiate from sibling tools, which are all payment-related, so this stands alone in purpose.

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 lists parameters but doesn't explain the context, prerequisites, or scenarios for invocation. Without such information, users must infer usage from the tool name and parameters alone.

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/yanboishere/infini-mcp'

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