Skip to main content
Glama
test_resources.py1.07 kB
"""Tests for resource templates.""" import base64 from fastmcp.client import Client async def test_echo_resource(client: Client): """Test echo resource template.""" result = await client.read_resource("resource://echo/hello-world") assert result[0].text == "hello-world" async def test_bytes_resource(client: Client): """Test bytes resource template returns correct size.""" result = await client.read_resource("resource://bytes/100") decoded = base64.b64decode(result[0].blob) assert len(decoded) == 100 async def test_json_sample_resource(client: Client): """Test JSON sample resource.""" result = await client.read_resource("resource://json/sample") assert "string" in result[0].text assert "integer" in result[0].text async def test_info_resource(client: Client): """Test the info resource.""" resources = await client.list_resources() assert any(str(r.uri) == "resource://info" for r in resources) result = await client.read_resource("resource://info") assert "mcpbin" in result[0].text

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/bugffet/mcpbin'

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