Skip to main content
Glama

select_notebook

Activate a specific notebook as the default context for AI queries, enabling focused document-based responses without manual switching.

Instructions

Set a notebook as the active default (used when ask_question has no notebook_id).

When To Use

  • User switches context: "Let's work on React now"

  • User asks explicitly to activate a notebook

  • Obvious task change requires another notebook

Auto-Switching

  • Safe to auto-switch if the context is clear and you announce it: "Switching to React notebook for this task..."

  • If ambiguous, ask: "Switch to [notebook] for this task?"

Example

User: "Now let's build the React frontend" You: "Switching to React notebook..." (call select_notebook)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesThe notebook ID to activate

Implementation Reference

  • Main handler function that executes the select_notebook tool logic. It validates the notebook ID, calls the library's selectNotebook method, and returns success/error with the selected notebook.
    /**
     * Handle select_notebook tool
     */
    async handleSelectNotebook(args: { id: string }): Promise<ToolResult<{ notebook: any }>> {
      log.info(`🔧 [TOOL] select_notebook called`);
      log.info(`  ID: ${args.id}`);
    
      try {
        const notebook = this.library.selectNotebook(args.id);
        log.success(`✅ [TOOL] select_notebook completed: ${notebook.name}`);
        return {
          success: true,
          data: { notebook },
        };
      } catch (error) {
        const errorMessage = error instanceof Error ? error.message : String(error);
        log.error(`❌ [TOOL] select_notebook failed: ${errorMessage}`);
        return {
          success: false,
          error: errorMessage,
        };
      }
    }
  • Tool definition including name, detailed description, strict input schema requiring 'id' parameter, and usage guidelines.
      {
        name: "select_notebook",
        description:
          `Set a notebook as the active default (used when ask_question has no notebook_id).
    
    ## When To Use
    - User switches context: "Let's work on React now"
    - User asks explicitly to activate a notebook
    - Obvious task change requires another notebook
    
    ## Auto-Switching
    - Safe to auto-switch if the context is clear and you announce it:
      "Switching to React notebook for this task..."
    - If ambiguous, ask: "Switch to [notebook] for this task?"
    
    ## Example
    User: "Now let's build the React frontend"
    You: "Switching to React notebook..." (call select_notebook)`,
        inputSchema: {
          type: "object",
          properties: {
            id: {
              type: "string",
              description: "The notebook ID to activate",
            },
          },
          required: ["id"],
        },
      },
  • Central function that aggregates and registers all tool definitions, including notebookManagementTools containing select_notebook, for export to the MCP server.
    export function buildToolDefinitions(library: NotebookLibrary): Tool[] {
      // Update the description for ask_question based on the library state
      const dynamicAskQuestionTool = {
        ...askQuestionTool,
        description: buildAskQuestionDescription(library),
      };
    
      return [
        dynamicAskQuestionTool,
        ...notebookManagementTools,
        ...sessionManagementTools,
        ...systemTools,
      ];
    }
  • Core helper method implementing the selection logic: retrieves notebook, sets as active in library state, updates last_used timestamp, persists to JSON file, and returns the updated entry.
    selectNotebook(id: string): NotebookEntry {
      const notebook = this.getNotebook(id);
      if (!notebook) {
        throw new Error(`Notebook not found: ${id}`);
      }
    
      log.info(`🎯 Selecting notebook: ${id}`);
    
      const updated = { ...this.library };
      updated.active_notebook_id = id;
    
      // Update last_used
      const notebookIndex = updated.notebooks.findIndex((n) => n.id === id);
      updated.notebooks[notebookIndex] = {
        ...notebook,
        last_used: new Date().toISOString(),
      };
    
      this.saveLibrary(updated);
      log.success(`✅ Active notebook: ${id}`);
    
      return updated.notebooks[notebookIndex];
    }
Behavior4/5

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

No annotations are provided, so the description carries the full burden. It discloses key behavioral traits: the tool sets an active default (implying state change), is safe for auto-switching in clear contexts, and requires caution in ambiguous cases. However, it lacks details on permissions, error handling, or side effects (e.g., impact on other tools), leaving some gaps in transparency.

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 well-structured and front-loaded, starting with the core purpose, followed by usage guidelines, auto-switching rules, and an example. Every sentence adds value without redundancy, and the bullet points enhance readability. It efficiently covers necessary information without unnecessary elaboration.

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 tool's moderate complexity (state-changing with one parameter), no annotations, and no output schema, the description is mostly complete. It explains the purpose, usage, and behavioral context but omits details on return values or error cases. It compensates well for the lack of structured data, though slight gaps remain in full behavioral disclosure.

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

Parameters3/5

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

Schema description coverage is 100%, with the parameter 'id' documented as 'The notebook ID to activate.' The description does not add meaning beyond this, as it doesn't specify format, source (e.g., from 'list_notebooks'), or validation rules. With high schema coverage, the baseline score of 3 is appropriate, as the schema handles parameter documentation adequately.

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 the tool's purpose: 'Set a notebook as the active default (used when ask_question has no notebook_id).' It specifies the verb ('Set'), resource ('notebook'), and distinguishes it from siblings like 'get_notebook' or 'list_notebooks' by focusing on activation as the default. The description explicitly ties it to the 'ask_question' tool, enhancing clarity.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description includes a dedicated 'When To Use' section with explicit scenarios (e.g., user switches context, asks explicitly, task change) and provides clear guidance on auto-switching vs. asking for confirmation. It distinguishes usage from alternatives by noting its role as the default for 'ask_question', helping the agent choose this over other notebook-related 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/inventra/notebooklm-mcp'

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