Skip to main content
Glama

get_details

Retrieve details of OTP tokens matching a specific pattern for secure authentication management on the otp-mcp-server, supporting TOTP and HOTP algorithms.

Instructions

Get the details of all the OTP tokens matching the pattern Args: pattern: Token pattern (part of the name or token number)

Input Schema

NameRequiredDescriptionDefault
patternYes

Input Schema (JSON Schema)

{ "properties": { "pattern": { "title": "Pattern", "type": "string" } }, "required": [ "pattern" ], "type": "object" }

Implementation Reference

  • The main handler for the 'get_details' tool. It uses helper functions find_tokens and format_token to retrieve and format details of OTP tokens matching the provided pattern. The @mcp.tool() decorator registers the tool.
    @mcp.tool() async def get_details(pattern: str) -> str: """ Get the details of all the OTP tokens matching the pattern Args: pattern: Token pattern (part of the name or token number) """ tokens_list = find_tokens(pattern) if not tokens_list: raise ToolError("No OTP tokens found.") return "\n---\n".join([format_token(x) for x in tokens_list])
  • Helper function that finds and returns a list of Token objects matching the given pattern, used by the get_details handler.
    def find_tokens(pattern: str) -> list[Token]: """ Find tokens matching the given pattern. """ db = get_token_db() if not pattern: return db.get_tokens() tokens_list = [] pattern = pattern.lower() for token in db.get_tokens(): tmp = str(token).lower().strip() if pattern in tmp or pattern == f"{token.rowid}#": tokens_list.append(token) return tokens_list
  • Helper function that formats the details of a single Token object into a readable string, used by the get_details handler.
    def format_token(token: Token) -> str: """ Format the token details for display. """ result: list[str] = [ f"Id: {token.rowid}#", f"Type: {token.type.name}", f"Algorithm: {token.algorithm}", f"Issuer: {token.issuer}", f"Account: {token.label}", f"Digits: {token.digits}", ] if token.type == TokenType.HOTP: result.append(f"Counter: {token.counter}") else: result.append(f"Period: {token.period} seconds") return "\n".join(result)

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/andreax79/otp-mcp'

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