Skip to main content
Glama
feuerdev
by feuerdev

list_labels

List all labels in your Google Keep account to organize and categorize notes efficiently.

Instructions

List all labels.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The tool handler for 'list_labels'. Decorated with @mcp.tool(), it calls get_client() and returns serialized labels as JSON.
    @mcp.tool()
    def list_labels() -> str:
        """List all labels."""
        keep = get_client()
        return json.dumps([serialize_label(label) for label in keep.labels()])
  • The serialize_label helper function that converts a label object into a dict with 'id' and 'name' fields.
    def serialize_label(label):
        return {'id': label.id, 'name': label.name}
  • The get_client() helper that initializes/reuses the Google Keep client used by list_labels.
    def get_client():
        """
        Get or initialize the Google Keep client.
        This ensures we only authenticate once and reuse the client.
        
        Returns:
            gkeepapi.Keep: Authenticated Keep client
        """
        global _keep_client
        
        if _keep_client is not None:
            return _keep_client
        
        # Load environment variables
        load_dotenv()
        
        # Get credentials from environment variables
        email = os.getenv('GOOGLE_EMAIL')
        master_token = os.getenv('GOOGLE_MASTER_TOKEN')
        
        if not email or not master_token:
            raise ValueError("Missing Google Keep credentials. Please set GOOGLE_EMAIL and GOOGLE_MASTER_TOKEN environment variables.")
        
        # Initialize the Keep API
        keep = gkeepapi.Keep()
        
        # Authenticate
        try:
            keep.authenticate(email, master_token)
        except requests.exceptions.JSONDecodeError as exc:
            raise RuntimeError(
                "Google Keep API returned a non-JSON response during authentication. "
                "This usually means the unofficial Keep API (notes/v1) is inaccessible "
                "from this environment (HTTP 403/4xx). "
                "Check that your GOOGLE_MASTER_TOKEN is valid and that the Keep API "
                "is reachable from this network."
            ) from exc
        except gkeepapi.exception.LoginException as exc:
            raise RuntimeError(
                f"Google Keep login failed: {exc}. "
                "Verify that GOOGLE_EMAIL and GOOGLE_MASTER_TOKEN are correct."
            ) from exc
        
        # Store the client for reuse
        _keep_client = keep
        
        return keep
  • The tool is registered via the @mcp.tool() decorator on FastMCP instance 'mcp' (line 14).
    @mcp.tool()
    def list_labels() -> str:
        """List all labels."""
        keep = get_client()
        return json.dumps([serialize_label(label) for label in keep.labels()])
  • No input parameters; returns a str (JSON array of label objects with id/name). Implicitly defined by the function signature and return type.
    @mcp.tool()
    def list_labels() -> str:
        """List all labels."""
        keep = get_client()
        return json.dumps([serialize_label(label) for label in keep.labels()])
Behavior2/5

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

With no annotations, the description carries full burden but only states the operation. No disclosure of ordering, pagination, permissions, or side effects beyond the basic read action.

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?

Extremely concise: one short sentence with no unnecessary words. Every part earns its place.

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?

Given the tool's simplicity (zero parameters, output schema present), the description is complete. It adequately describes the action and result.

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?

No parameters exist, schema coverage is 100%. The description adds value by confirming 'all labels', clarifying the unfiltered scope beyond the empty 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 'List all labels' uses a specific verb ('list') and resource ('labels') with clear scope ('all'), distinguishing it from sibling tools like create_label or delete_label.

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 on when to use this tool vs alternatives. The description does not mention exclusions or provide context for choosing list_labels over other similar tools.

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/feuerdev/keep-mcp'

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