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
| Name | Required | Description | Default |
|---|---|---|---|
| work_id | Yes |
Implementation Reference
- mcp_musicbrainz/server.py:574-598 (handler)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) - mcp_musicbrainz/server.py:572-573 (registration)The registration of the 'get_work_details' function as an MCP tool, also decorated with a caching mechanism.
@mcp.tool() @cached_tool()