Skip to main content
Glama
digital-duck

Model Context Protocol Demo

by digital-duck
test_mcp.py734 B
#!/usr/bin/env python # coding: utf-8 """ this script tests `client.list_tools()` """ from fastmcp import Client import asyncio def format_tool(tool: dict): return f""" [name]\t {tool.get("name")} [description] {tool.get("description")} """ async def run_llm_demo(server_path: str = "mcp_server.py"): available_tools = [] async with Client(server_path) as client: tools = await client.list_tools() # print(f"tools: {tools}\n") if tools: available_tools = [ {"name": tool.name, "description": tool.description} for tool in tools ] return available_tools resp = asyncio.run(run_llm_demo()) for r in resp: print(10*"*") print(format_tool(r))

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/digital-duck/mcp_demo'

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