Skip to main content
Glama
zas

MusicBrainz MCP Server

by zas

get_work_details

Retrieve detailed information about musical works including composers, lyricists, and related metadata from the MusicBrainz database.

Instructions

Get details about a musical work (composers, lyricists, etc.).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
work_idYes

Implementation Reference

  • The handler function for 'get_work_details' tool, which fetches musical work information from MusicBrainz API and formats it into a readable string.
    def get_work_details(work_id: str) -> str:
        """Get details about a musical work (composers, lyricists, etc.)."""
        res = musicbrainzngs.get_work_by_id(
            work_id,
            includes=["artist-rels", "tags", "ratings"],
        )
        w = res["work"]
        tags = [t["name"] for t in w.get("tag-list", [])]
        genres = ", ".join(tags) if tags else ""
    
        creators = []
        for rel in w.get("artist-relation-list", []):
            rtype = rel["type"]
            artist = rel["artist"]["name"]
            creators.append(f"  - {rtype.capitalize()}: {artist}")
    
        parts = [
            f"Title: {w['title']}",
            f"Type: {w.get('type', 'Unknown')}",
            f"Genres: {genres or 'None listed'}",
            f"MBID: {work_id}",
            "\nCreators:",
            *(creators or ["  - No creators listed"]),
        ]
        return "\n".join(parts)
  • The registration of the 'get_work_details' function as an MCP tool, also decorated with a caching mechanism.
    @mcp.tool()
    @cached_tool()

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/zas/mcp-musicbrainz'

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