Skip to main content
Glama

HWP MCP Server

by jkf87
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Tests for Command Parser """ import pytest from src.utils.command_parser import CommandParser def test_command_parser_valid_json(): """Test parsing valid JSON commands.""" parser = CommandParser() # Test basic command command = parser.parse('{"type": "open_document", "params": {"path": "test.hwp"}}') assert command["type"] == "open_document" assert command["params"]["path"] == "test.hwp" # Test command without params command = parser.parse('{"type": "get_text"}') assert command["type"] == "get_text" assert "params" not in command def test_command_parser_invalid_json(): """Test parsing invalid JSON commands.""" parser = CommandParser() # Test invalid JSON with pytest.raises(ValueError) as e: parser.parse('{type: "open_document"}') assert "Invalid JSON format" in str(e.value) # Test non-dict JSON with pytest.raises(ValueError) as e: parser.parse('["open_document"]') assert "Command must be a JSON object" in str(e.value) # Test missing type with pytest.raises(ValueError) as e: parser.parse('{"params": {"path": "test.hwp"}}') assert "Command must have a 'type' field" in str(e.value) # Test invalid params with pytest.raises(ValueError) as e: parser.parse('{"type": "open_document", "params": "test.hwp"}') assert "Command params must be a JSON object" in str(e.value)

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/jkf87/hwp-mcp'

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