Skip to main content
Glama
martoc

MCP Spark Documentation Server

by martoc

read_documentation

Retrieve the full markdown content of a Spark documentation page by providing its relative file 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 of the read_documentation tool. Calls get_database().get_document(path) and returns JSON-formatted document content or an error message.
    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,
        )
  • The @mcp.tool() decorator registers read_documentation as an MCP tool. The function accepts a path string and 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 get_document(path) called by the handler. Queries the SQLite 'documents' table by path and returns a Document dataclass 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
  • The Document dataclass model used to represent the documentation content returned by read_documentation.
    @dataclass
    class Document:
        """Represents a documentation page."""
    
        path: str
        title: str
        description: str | None
        section: str
        content: str
        url: str
Behavior4/5

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

The description discloses that the tool returns full markdown content or an error message if not found. With no annotations, this covers basic behavior but does not mention potential side effects or access constraints.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise with two sentences and clear separation of Args and Returns, providing all necessary information without redundancy.

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

Completeness5/5

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

For a simple tool with one parameter and an existing output schema, the description covers purpose, usage, and return behavior completely.

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 description thoroughly explains the 'path' parameter with examples and clarifies it is the same path returned by search_documentation, adding significant value beyond the schema.

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 'Read the full content of a specific Spark documentation page,' specifying the verb, resource, and context. It distinguishes from sibling 'search_documentation' by implying that read fetches content while search returns paths.

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?

The description explains that the path argument should be relative and comes from search results, indicating appropriate use after search. However, it does not explicitly state when not to use or provide exclusion criteria.

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