Skip to main content
Glama

get_library_stats

Retrieve statistics about your notebook library, including total notebooks and usage data, to monitor document collection activity.

Instructions

Get statistics about your notebook library (total notebooks, usage, etc.)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function for the get_library_stats tool. It calls this.library.getStats() to retrieve library statistics and returns them wrapped in ToolResult format, with proper logging and error handling.
    /**
     * Handle get_library_stats tool
     */
    async handleGetLibraryStats(): Promise<ToolResult<any>> {
      log.info(`🔧 [TOOL] get_library_stats called`);
    
      try {
        const stats = this.library.getStats();
        log.success(`✅ [TOOL] get_library_stats completed`);
        return {
          success: true,
          data: stats,
        };
      } catch (error) {
        const errorMessage = error instanceof Error ? error.message : String(error);
        log.error(`❌ [TOOL] get_library_stats failed: ${errorMessage}`);
        return {
          success: false,
          error: errorMessage,
        };
      }
    }
  • The tool schema definition, specifying the name, description, and empty input schema (no parameters required).
    {
      name: "get_library_stats",
      description: "Get statistics about your notebook library (total notebooks, usage, etc.)",
      inputSchema: {
        type: "object",
        properties: {},
      },
    },
  • src/index.ts:228-230 (registration)
    The switch case in the main tool call handler that dispatches calls to the specific handleGetLibraryStats method.
    case "get_library_stats":
      result = await this.toolHandlers.handleGetLibraryStats();
      break;
  • The supporting getStats method in NotebookLibrary class that computes and returns library statistics: total notebooks, active notebook, most used, total queries, last modified.
    getStats(): LibraryStats {
      const totalQueries = this.library.notebooks.reduce(
        (sum, n) => sum + n.use_count,
        0
      );
    
      const mostUsed = this.library.notebooks.reduce((max, n) =>
        n.use_count > (max?.use_count || 0) ? n : max
      , null as NotebookEntry | null);
    
      return {
        total_notebooks: this.library.notebooks.length,
        active_notebook: this.library.active_notebook_id,
        most_used_notebook: mostUsed?.id || null,
        total_queries: totalQueries,
        last_modified: this.library.last_modified,
      };
    }

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A3.5/5.0
Behavior3/5

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

No annotations are provided, so the description carries the burden of behavioral disclosure. It clearly indicates a read-only statistics operation, which is sufficient for this simple zero-parameter tool, though it does not detail what 'usage' includes or specify return structure.

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 a single, front-loaded sentence with no redundancy. It communicates the core purpose efficiently and includes concrete examples without unnecessary detail.

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?

For a zero-parameter, read-only statistics tool, the description is largely complete. The absence of an output schema is partially mitigated by the examples given, though exact fields and format remain unspecified.

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?

The tool has zero parameters, so parameter semantics are not applicable; the baseline of 4 reflects that no parameter guidance is needed. The description's mention of the statistics content compensates for the lack of an output schema.

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

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a clear verb ('get') and a specific resource ('statistics about your notebook library'), with examples like total notebooks and usage. It is distinguishable from sibling tools like list_notebooks or get_notebook, though it does not explicitly name them.

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?

The description implies this tool is for high-level library statistics, but gives no explicit guidance on when to use it versus listing notebooks or querying individual notebook details. There are no stated exclusions or alternative tool references.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.