Skip to main content
Glama
Samge0

MCP QQ Music Test Server

by Samge0

search_music

Retrieve music tracks matching a keyword using the MCP QQ Music Test Server. Specify pagination and result limits to find and access song information efficiently.

Instructions

Search for music tracks

Args: keyword: Search keyword or phrase page: Page number for pagination (default: 1) num: Maximum number of results to return (default: 20)

Returns: List of music tracks matching the search criteria

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keywordYes
numNo
pageNo

Implementation Reference

  • main.py:9-9 (registration)
    Registers the search_music tool with the FastMCP server using the @mcp.tool() decorator.
    @mcp.tool()
  • main.py:10-21 (schema)
    Input schema defined by function signature (keyword: str, page: int=1, num: int=20) and docstring describing parameters and return type (list of tracks).
    async def search_music(keyword: str, page: int = 1, num: int = 20): """ Search for music tracks Args: keyword: Search keyword or phrase page: Page number for pagination (default: 1) num: Maximum number of results to return (default: 20) Returns: List of music tracks matching the search criteria """
  • main.py:10-41 (handler)
    The handler function executes the tool: awaits search from qqmusic_api, filters results into song_info dictionaries with fields id, mid, name, pmid, subtitle, time_public, title, and returns the list.
    async def search_music(keyword: str, page: int = 1, num: int = 20): """ Search for music tracks Args: keyword: Search keyword or phrase page: Page number for pagination (default: 1) num: Maximum number of results to return (default: 20) Returns: List of music tracks matching the search criteria """ result = await search.search_by_type(keyword=keyword, page=page, num=num) # 提取指定字段 # json.dumps(result, ensure_ascii=False) - 这行代码没有实际作用,因为结果没有被使用 if isinstance(result, list): filtered_list = [] for item in result: # 提取歌曲信息而不是专辑信息 song_info = { "id": item.get("id"), "mid": item.get("mid"), "name": item.get("name"), "pmid": item.get("pmid", ""), "subtitle": item.get("subtitle", ""), "time_public": item.get("time_public", ""), "title": item.get("title", item.get("name", "")) } filtered_list.append(song_info) return filtered_list

Other Tools

Related Tools

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/Samge0/mcp-qqmusic-test-server'

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