Skip to main content
Glama
martoc

MCP Spark Documentation Server

by martoc

read_documentation

Retrieve the full markdown content of any Apache Spark documentation page by providing its relative path.

Instructions

Read the full content of a specific Spark documentation page.

Args: path: The relative path to the documentation file (e.g., 'sql-ref/sql-syntax.md' or 'api/python/index.md'). This path is returned in search results.

Returns: The full markdown content of the documentation page, or an error message if the page is not found.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Core implementation that retrieves a document by path from the database and returns it as JSON.
    def _read_documentation_impl(path: str) -> str:
        """Core implementation of read_documentation.
    
        Args:
            path: The relative path to the documentation file.
    
        Returns:
            JSON-formatted document content or error message.
        """
        db = get_database()
        document = db.get_document(path)
    
        if not document:
            return json.dumps(
                {
                    "error": f"Document not found: {path}",
                    "suggestion": "Use search_documentation to find valid document paths.",
                }
            )
    
        return json.dumps(
            {
                "path": document.path,
                "title": document.title,
                "description": document.description,
                "section": document.section,
                "url": document.url,
                "content": document.content,
            },
            indent=2,
        )
  • MCP tool handler function decorated with @mcp.tool() that delegates to _read_documentation_impl.
    @mcp.tool()
    def read_documentation(path: str) -> str:
        """Read the full content of a specific Spark documentation page.
    
        Args:
            path: The relative path to the documentation file (e.g.,
                  'sql-ref/sql-syntax.md' or 'api/python/index.md'). This path
                  is returned in search results.
    
        Returns:
            The full markdown content of the documentation page, or an error
            message if the page is not found.
        """
        return _read_documentation_impl(path)
  • Database helper method that queries the documents table by path and returns a Document or None.
    def get_document(self, path: str) -> Document | None:
        """Retrieve a document by path.
    
        Args:
            path: Relative path to the document.
    
        Returns:
            Document instance or None if not found.
        """
        with self._get_connection() as conn:
            cursor = conn.execute(
                "SELECT * FROM documents WHERE path = ?",
                (path,),
            )
            row = cursor.fetchone()
            if row:
                return Document(
                    path=row["path"],
                    title=row["title"],
                    description=row["description"],
                    section=row["section"],
                    content=row["content"],
                    url=row["url"],
                )
            return None
  • Data model for a Document, representing the schema of data returned by read_documentation.
    class Document:
        """Represents a documentation page."""
    
        path: str
        title: str
        description: str | None
        section: str
        content: str
        url: str
  • Tool registration via the @mcp.tool() decorator on the FastMCP instance.
    @mcp.tool()
    def read_documentation(path: str) -> str:
        """Read the full content of a specific Spark documentation page.
    
        Args:
            path: The relative path to the documentation file (e.g.,
                  'sql-ref/sql-syntax.md' or 'api/python/index.md'). This path
                  is returned in search results.
    
        Returns:
            The full markdown content of the documentation page, or an error
            message if the page is not found.
        """
        return _read_documentation_impl(path)
Behavior3/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. It discloses that the operation reads and returns full markdown content or an error. However, it does not mention idempotency, side effects (likely none), or any constraints like file size limits. The description is adequate but lacks depth.

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 structured with docstring headers ('Args:', 'Returns:') which adds clarity but is slightly verbose for a simple parameter. The information is front-loaded and every sentence serves a purpose, though it could be more concise.

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

Completeness4/5

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

Given the tool's simplicity (1 parameter, no nested objects, and an output schema mentioned but not provided), the description covers the essential aspects: what it does, the parameter format, and the return type. It also ties to the sibling tool. It could expand on page size or encoding but is sufficiently complete.

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

Parameters5/5

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

The schema has 0% description coverage, so the description compensates fully. It explains the 'path' parameter with examples ('sql-ref/sql-syntax.md') and context (path returned in search results). This adds significant meaning beyond the schema's type-only definition.

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

Purpose5/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: 'Read the full content of a specific Spark documentation page.' The verb 'Read' and resource 'full content of a specific documentation page' are specific and distinguishable from the sibling tool 'search_documentation', which implies searching rather than reading full content.

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

Usage Guidelines4/5

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

Implicitly indicates usage by stating the path is 'returned in search results', connecting to the sibling tool. However, no explicit when-to-use or when-not-to-use instructions are provided. The description focuses on what the tool does rather than when to choose it over alternatives.

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/martoc/mcp-spark-documentation'

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