Skip to main content
Glama
Cifero74

mcp-apple-music

search_library

Find songs, albums, artists, and playlists in your personal Apple Music library using search queries and customizable filters.

Instructions

Search within your personal Apple Music library.

Args: query: Search term. types: Comma-separated types. Options: library-songs, library-albums, library-artists, library-playlists limit: Results per type, 1–25 (default 10).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes
typesNolibrary-songs,library-albums,library-artists,library-playlists
limitNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The implementation of the search_library tool, decorated with @mcp.tool() and utilizing the Apple Music API's library search endpoint.
    @mcp.tool()
    async def search_library(
        query: str,
        types: str = "library-songs,library-albums,library-artists,library-playlists",
        limit: int = 10,
    ) -> str:
        """Search within your personal Apple Music library.
    
        Args:
            query: Search term.
            types: Comma-separated types.
                   Options: library-songs, library-albums, library-artists, library-playlists
            limit: Results per type, 1–25 (default 10).
        """
        client = _get_client()
        data = await client.get(
            "/me/library/search",
            params={"term": query, "types": types, "limit": min(max(1, limit), 25)},
        )
        results = data.get("results", {})
        lines = [f"šŸ” Library search: '{query}'\n"]
    
        if songs := results.get("library-songs", {}).get("data", []):
            lines.append("šŸŽµ Songs:")
            for i, s in enumerate(songs, 1):
                lines.append(_fmt_song(s, i))
    
        if albums := results.get("library-albums", {}).get("data", []):
            lines.append("\nšŸ’æ Albums:")
            for i, a in enumerate(albums, 1):
                lines.append(_fmt_album(a, i))
    
        if artists := results.get("library-artists", {}).get("data", []):
            lines.append("\nšŸ‘¤ Artists:")
            for i, a in enumerate(artists, 1):
                lines.append(_fmt_artist(a, i))
    
        if playlists := results.get("library-playlists", {}).get("data", []):
            lines.append("\nšŸ“‹ Playlists:")
            for i, p in enumerate(playlists, 1):
                lines.append(_fmt_playlist(p, i))
    
        if len(lines) == 1:
            return f"Nothing found in your library for '{query}'."
        return "\n".join(lines)
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden. It successfully documents pagination limits (1-25) and available type options, but omits critical behavioral context like authentication requirements, rate limits, or search scope (which fields are indexed).

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Information is efficiently organized with the purpose statement first, followed by Args documentation. The 'Args:' header format is slightly informal but every sentence earns its place; no redundant text or tautology.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the output schema exists and parameters are documented in the description, the essentials are covered. However, for a search tool with zero annotations, the description should ideally address authentication requirements and the relationship to sibling 'get_library_*' tools (when to search vs. list).

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema has 0% description coverage (only titles). The description compensates effectively by documenting all three parameters: 'Search term' for query, comma-separated type options with the four valid values for types, and range constraints with defaults for limit.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with 'Search within your personal Apple Music library'—a specific verb-plus-resource statement that clearly distinguishes this from the sibling 'search_catalog' tool by emphasizing the personal library scope versus the public catalog.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The phrase 'personal Apple Music library' provides implicit context for when to use this tool (vs. 'search_catalog'), but lacks explicit guidance on prerequisites (e.g., requiring Apple Music subscription/library access) or conditions when this might return empty results.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/Cifero74/mcp-apple-music'

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