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
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states the tool 'gets' a text, implying a read operation, but doesn't disclose behavioral traits like authentication needs, rate limits, error handling, or what 'get' entails (e.g., returns full text, metadata, or formatting). The description is minimal and lacks context beyond the basic action.

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 a single, efficient sentence: 'get a jewish text from the jewish library'. It's appropriately sized and front-loaded with the core action. There's no wasted verbiage, though it could be more structured with additional context.

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 no annotations, no output schema, and a simple input schema, the description is incomplete. It lacks details on what the tool returns (e.g., text content, format), error conditions, or behavioral context. For a tool with minimal structured data, the description should provide more completeness to guide effective use.

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?

Schema description coverage is 100%, with the parameter 'reference' fully documented in the schema. The description doesn't add any parameter semantics beyond what the schema provides (e.g., no examples or usage tips). Baseline is 3 since the schema does the heavy lifting, but the description doesn't compensate or enhance parameter understanding.

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

Purpose4/5

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

The description clearly states the tool's purpose: 'get a jewish text from the jewish library' specifies the verb 'get' and resource 'jewish text' with source context. It doesn't explicitly differentiate from the sibling 'get_commentaries', but the resource type distinction is implied. The description avoids tautology by not just restating the tool name.

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 the sibling tool 'get_commentaries' or any other context for selection. Usage is implied only by the tool's name and purpose, with no explicit when/when-not instructions or prerequisites stated.

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

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