Skip to main content
Glama
OpenTorah-ai

Sefaria Jewish Library MCP Server

by OpenTorah-ai

get_text

Retrieve Jewish texts and commentaries from the Sefaria library by providing a specific reference, enabling access to traditional and scholarly resources.

Instructions

get a jewish text from the jewish library

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
referenceYesThe reference of the jewish text, e.g. 'שולחן ערוך אורח חיים סימן א' or 'Genesis 1:1'

Implementation Reference

  • The primary handler function for the 'get_text' tool. It retrieves Hebrew text from the Sefaria API for the provided reference by calling get_hebrew_text and converting it to string.
    async def get_text(reference: str) -> str: """ Retrieves the text for a given reference. """ return str(get_hebrew_text(reference))
  • JSON Schema defining the input for the 'get_text' tool, specifying a required 'reference' parameter of type string.
    inputSchema={ "type": "object", "properties": { "reference": { "type": "string", "description": "The reference of the jewish text, e.g. 'שולחן ערוך אורח חיים סימן א' or 'Genesis 1:1'", }, }, "required": ["reference"], },
  • Registers the 'get_text' tool with the MCP server in the list_tools handler, including name, description, and schema.
    types.Tool( name="get_text", description="get a jewish text from the jewish library", inputSchema={ "type": "object", "properties": { "reference": { "type": "string", "description": "The reference of the jewish text, e.g. 'שולחן ערוך אורח חיים סימן א' or 'Genesis 1:1'", }, }, "required": ["reference"], }, ),
  • Helper function called by get_text to fetch the Hebrew text from Sefaria API using get_request_json_data.
    def get_hebrew_text(parasha_ref): """ Retrieves the Hebrew text and version title for the given verse. """ data = get_request_json_data("api/v3/texts/", parasha_ref) if data and "versions" in data and len(data['versions']) > 0: he_pasuk = data['versions'][0]['text'] return he_pasuk else: print(f"Could not retrieve Hebrew text for {parasha_ref}") return None

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/OpenTorah-ai/mcp-sefaria-server'

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