Skip to main content
Glama
nickweedon

Skeleton MCP Server

by nickweedon

list_items

Retrieve items with pagination and optional name filtering to manage and navigate data collections efficiently.

Instructions

List all items with optional filtering and pagination.

Args: page: Page number (1-indexed) page_size: Number of items per page filter_name: Optional filter by name (case-insensitive contains)

Returns: A dictionary containing: - items: List of item objects - total: Total number of items matching the filter - page: Current page number - page_size: Number of items per page

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pageNo
page_sizeNo
filter_nameNo

Implementation Reference

  • The handler function that implements the list_items tool logic, including pagination, filtering, and mock data handling.
    async def list_items(
        page: int = 1,
        page_size: int = 10,
        filter_name: str | None = None,
    ) -> dict[str, Any]:
        """
        List all items with optional filtering and pagination.
    
        Args:
            page: Page number (1-indexed)
            page_size: Number of items per page
            filter_name: Optional filter by name (case-insensitive contains)
    
        Returns:
            A dictionary containing:
            - items: List of item objects
            - total: Total number of items matching the filter
            - page: Current page number
            - page_size: Number of items per page
        """
        # In a real implementation:
        # client = get_client()
        # return client.get("items", params={"page": page, "page_size": page_size})
    
        items = list(MOCK_ITEMS.values())
    
        if filter_name:
            items = [i for i in items if filter_name.lower() in i["name"].lower()]
    
        total = len(items)
        start = (page - 1) * page_size
        end = start + page_size
        items = items[start:end]
    
        return {
            "items": items,
            "total": total,
            "page": page,
            "page_size": page_size,
        }
  • The registration of the list_items tool using FastMCP by applying mcp.tool() to the imported example.list_items function.
    mcp.tool()(example.list_items)

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/nickweedon/playwritght-proxy-mcp'

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