Skip to main content
Glama
mohdhaji87

JWT Auditor MCP Server

by mohdhaji87

jwt_decode

Decode JWT tokens to inspect header, payload, and signature components without verification for security auditing and analysis.

Instructions

Decode a JWT and return its header, payload, and signature (no verification).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tokenYes

Implementation Reference

  • server.py:9-29 (handler)
    The jwt_decode tool handler function. It is registered via the @server.tool() decorator. The function splits the JWT token into header, payload, and signature parts, base64 decodes the header and payload (handling padding), parses them as JSON, and returns a dict with header, payload, and raw signature. Errors are caught and returned as {"error": str(e)}.
    @server.tool()
    def jwt_decode(token: str) -> dict:
        """Decode a JWT and return its header, payload, and signature (no verification)."""
        try:
            header_b64, payload_b64, signature_b64 = token.split(".")
            def b64decode(data):
                # Add padding if needed
                rem = len(data) % 4
                if rem:
                    data += '=' * (4 - rem)
                return base64.urlsafe_b64decode(data.encode())
            header = json.loads(b64decode(header_b64))
            payload = json.loads(b64decode(payload_b64))
            signature = signature_b64
            return {
                "header": header,
                "payload": payload,
                "signature": signature
            }
        except Exception as e:
            return {"error": str(e)}
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses that the tool decodes without verification, which is a key behavioral trait. However, it lacks details on error handling, output format, or any rate limits or permissions needed, leaving gaps in behavioral context.

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 front-loads the purpose and key limitation ('no verification'), with zero wasted words, making it highly concise 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 moderate complexity (decoding without verification), no annotations, and no output schema, the description is adequate but incomplete. It covers the basic purpose and a key limitation, but lacks details on return values, error cases, or how it differs from siblings, which could hinder agent selection.

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

Parameters4/5

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

The description adds meaning beyond the input schema by specifying that the 'token' parameter is a JWT to decode. Since schema description coverage is 0% and there is only one parameter, this compensates well, though it could provide more details on token format or constraints.

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 ('Decode a JWT') and the resource (a JWT token), distinguishing it from siblings like jwt_analyze, jwt_bruteforce, and jwt_generate by specifying it returns header, payload, and signature without verification.

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

Usage Guidelines4/5

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

The description provides clear context by stating 'no verification,' implying this tool is for inspection rather than security validation. However, it does not explicitly mention when to use it versus alternatives like jwt_analyze or jwt_bruteforce, which might offer more detailed analysis or verification features.

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/mohdhaji87/JWTAuditorMCP'

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