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 reference such as 'Genesis 1:1' or 'שולחן ערוך אורח חיים סימן א'.

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

  • Core handler function for the 'get_text' tool that retrieves Hebrew text from the Sefaria API for the given reference.
    async def get_text(reference: str) -> str:
        """
        Retrieves the text for a given reference.
        """
        return str(get_hebrew_text(reference))
  • Dispatch handler within @server.call_tool() that processes 'get_text' tool calls, extracts the 'reference' argument, invokes get_text, and formats the response as TextContent.
    if name == "get_text":
        try:
            reference = arguments.get("reference")
            if not  reference:
                raise ValueError("Missing reference parameter")  
            
            logger.debug(f"handle_get_text: {reference}")
            text = await get_text(reference)
            
            
            return [types.TextContent(
                type="text",
                text= text
            )]
        except Exception as err:
            logger.error(f"retreive text error: {err}", exc_info=True)
            return [types.TextContent(
                type="text",
                text=f"Error: {str(err)}"
            )]
  • Tool registration in @server.list_tools(): defines name, description, and input schema requiring a 'reference' string.
    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"],
        },
    ),
  • JSON schema for 'get_text' tool input: object with required 'reference' property 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"],
    },
  • Helper function used by get_text to query the Sefaria API for Hebrew text of the reference.
    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

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

C2.6/5.0
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the action ('get') but doesn't describe traits like whether this is a read-only operation, if it requires authentication, what happens on errors (e.g., invalid reference), or rate limits. The description is minimal and lacks essential behavioral context for a tool with no annotation support.

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?

The description is concise and front-loaded in a single sentence ('get a jewish text from the jewish library'), with zero wasted words. It efficiently states the core purpose without unnecessary elaboration, making it easy to parse. However, it's slightly under-specified given the lack of sibling differentiation and behavioral details.

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

Completeness2/5

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

Given the tool's complexity (a read operation with one parameter) and lack of annotations and output schema, the description is incomplete. It doesn't cover behavioral aspects, error handling, or output format, leaving gaps for an agent to invoke it correctly. With no structured support, the description should provide more context but falls short.

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

Parameters3/5

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

The input schema has 100% description coverage, with the 'reference' parameter well-documented in the schema (including examples like 'Genesis 1:1'). The description adds no additional parameter semantics beyond what the schema provides—it doesn't explain reference formats, constraints, or usage. Baseline 3 is appropriate as the schema does the heavy lifting.

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

Purpose3/5

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

The description states the tool's purpose ('get a jewish text from the jewish library'), which is clear but vague. It specifies the verb ('get') and resource ('jewish text'), but doesn't differentiate from siblings like 'search_texts' or 'get_commentaries'—it's unclear if this fetches a single text by reference versus searching. The purpose is understandable but lacks specificity for sibling distinction.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives. The description doesn't mention prerequisites, exclusions, or compare to sibling tools like 'search_texts' (which might handle broader queries) or 'get_commentaries' (which might retrieve related content). Usage is implied from the name and description alone, with no explicit context for selection.

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

Deploy Server

Other Tools