Skip to main content
Glama

get_pep

Retrieve Python Enhancement Proposals (PEPs) by number to access official documentation, with options for excerpts or full content.

Instructions

Get a PEP by number. Use query for excerpts; full body is capped by default.

Pass max_full_content_chars=0 for an uncapped full document (can be very large).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pepYes
queryNo
max_full_content_charsNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Registration of the 'get_pep' tool in the MCP server.
    @mcp.tool
    async def get_pep(
        pep: int | str,
        query: str | None = None,
        max_full_content_chars: int | None = None,
    ) -> dict:
        """Get a PEP by number. Use ``query`` for excerpts; full body is capped by default.
    
        Pass ``max_full_content_chars=0`` for an uncapped full document (can be very large).
        """
        return await peps_client.get_pep_context(
            pep=pep,
            query=query,
            max_full_content_chars=max_full_content_chars,
        )
  • Implementation of the 'get_pep_context' method in PepsClient, which handles the logic for the 'get_pep' tool.
    async def get_pep_context(
        self,
        pep: int | str,
        query: str | None = None,
        excerpt_context_lines: int = 3,
        max_full_content_chars: int | None = None,
    ) -> dict[str, Any]:
        """Return metadata and full content or focused excerpt for a single PEP."""
        pep_number = self._normalize_pep_number(pep)
        padded = self._pad_pep_number(pep_number)
        index = await self._get_index()
        metadata = index.get(str(pep_number), {})
    
        text = await self._fetch_pep_text(padded)
        result: dict[str, Any] = {
            "number": pep_number,
            "title": metadata.get("title"),
            "status": metadata.get("status"),
            "type": metadata.get("type"),
            "topic": metadata.get("topic"),
            "created": metadata.get("created"),
            "url": metadata.get("url"),
        }
    
        limit = self._resolve_full_content_limit(max_full_content_chars)
    
        query_value = (query or "").strip()
        if query_value:
            excerpt = self.extract_relevant_excerpt(
                text=text,
                query=query_value,
                context_lines=excerpt_context_lines,
            )
            result["query"] = query_value
            result["excerpt"] = excerpt
            result["content_truncated"] = bool(excerpt)
            if not excerpt:
                result["content"] = self._truncate_text(text, limit)
                result["content_truncated"] = result["content"] != text
            return result
    
        result["content"] = self._truncate_text(text, limit)
        result["content_truncated"] = result["content"] != text
        return result
Behavior4/5

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

No annotations provided, so description carries full burden. Discloses critical behavioral traits: full body is capped by default, setting max_full_content_chars=0 removes the cap, and uncapped documents 'can be very large.' Does not mention rate limits or auth requirements.

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?

Three sentences with zero waste. Front-loaded with core purpose ('Get a PEP by number'), followed by usage guidance for specific parameters. Every sentence earns its place.

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 output schema exists, the description appropriately omits return value details. With 0% schema coverage, it compensates by explaining parameter semantics. Could strengthen by explicitly contrasting with list_peps for enumeration use cases.

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

Parameters4/5

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

Schema coverage is 0%, requiring description to compensate. Successfully adds meaning for all three parameters: 'pep' is referenced as 'by number,' 'query' is for 'excerpts,' and 'max_full_content_chars' controls capping behavior with explicit warning about large document sizes.

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?

States specific verb ('Get') + resource ('PEP') + identifier method ('by number'). The mention of using 'query for excerpts' effectively distinguishes this retrieval tool from the sibling search_peps and list_peps tools.

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?

Provides clear guidance on when to use the 'query' parameter (for excerpts) versus full retrieval, and explains the 'max_full_content_chars' parameter behavior. Lacks explicit guidance on when to prefer search_peps over this tool for search scenarios.

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/ribbit-br/mcp-pep-server'

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