avatar / test_mcp_http.py
mwtuni's picture
improved MCP tooling with schemas
857ffa3
raw
history blame contribute delete
724 Bytes
import json
import httpx
HTTP_ENDPOINT = "http://localhost:7866/mcp/http"
DEFAULT_AVATAR = "08a2fb96"
def main():
with httpx.Client(timeout=15) as client:
info = client.get(HTTP_ENDPOINT)
info.raise_for_status()
data = info.json()
tools = data.get("tools") or []
print("Available tools:")
for tool in tools:
print(f"- {tool}")
sample = {
"tool": "get_avatar",
"payload": {"avatar_id": DEFAULT_AVATAR},
}
resp = client.post(HTTP_ENDPOINT, json=sample)
resp.raise_for_status()
print("\nSample response:")
print(json.dumps(resp.json(), indent=2))
if __name__ == "__main__":
main()