Skip to main content
Glama
exceptions.py1.48 kB
import fastmcp.exceptions class HNPXError(fastmcp.exceptions.ToolError): """Base exception for HNPX errors""" pass class DuplicateIDError(HNPXError): def __init__(self, node_id: str): super().__init__(f"Node ID '{node_id}' already exists in the document") class InvalidParentError(HNPXError): def __init__(self, parent_type: str, expected_type: str): super().__init__(f"Parent must be a {expected_type}, not {parent_type}") class NodeNotFoundError(HNPXError): def __init__(self, node_id: str): super().__init__(f"Node with id '{node_id}' not found") class InvalidAttributeError(HNPXError): def __init__(self, attr: str, value: str, reason: str): super().__init__(f"Invalid value '{value}' for attribute '{attr}': {reason}") class MissingAttributeError(HNPXError): def __init__(self, attr: str): super().__init__(f"Missing required attribute: '{attr}'") class InvalidHierarchyError(HNPXError): def __init__(self, parent_tag: str, child_tag: str): super().__init__(f"Cannot add {child_tag} to {parent_tag} - invalid hierarchy") class ValidationError(HNPXError): def __init__(self, errors: list): error_messages = "\n".join([str(e) for e in errors]) super().__init__(f"Schema validation failed:\n{error_messages}") class InvalidOperationError(HNPXError): def __init__(self, operation: str, reason: str): super().__init__(f"Cannot {operation}: {reason}")

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/mozhaa/hnpx-sdk'

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