Skip to main content
Glama

update_notebook

Modify notebook metadata including topics, description, tags, and use cases to keep content organized and current.

Instructions

Update notebook metadata based on user intent.

Pattern

  1. Identify target notebook and fields (topics, description, use_cases, tags, url)

  2. Propose the exact change back to the user

  3. After explicit confirmation, call this tool

Examples

  • User: "React notebook also covers Next.js 14" You: "Add 'Next.js 14' to topics for React?" User: "Yes" → call update_notebook

  • User: "Include error handling in n8n description" You: "Update the n8n description to mention error handling?" User: "Yes" → call update_notebook

Tip: You may update multiple fields at once if requested.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesThe notebook ID to update
nameNoNew display name
descriptionNoNew description
topicsNoNew topics list
content_typesNoNew content types
use_casesNoNew use cases
tagsNoNew tags
urlNoNew notebook URL

Implementation Reference

  • Main MCP tool handler: receives args, delegates to library.updateNotebook, handles errors and logging.
     * Handle update_notebook tool
     */
    async handleUpdateNotebook(args: UpdateNotebookInput): Promise<ToolResult<{ notebook: any }>> {
      log.info(`🔧 [TOOL] update_notebook called`);
      log.info(`  ID: ${args.id}`);
    
      try {
        const notebook = this.library.updateNotebook(args);
        log.success(`✅ [TOOL] update_notebook completed: ${notebook.name}`);
        return {
          success: true,
          data: { notebook },
        };
      } catch (error) {
        const errorMessage = error instanceof Error ? error.message : String(error);
        log.error(`❌ [TOOL] update_notebook failed: ${errorMessage}`);
        return {
          success: false,
          error: errorMessage,
        };
      }
    }
  • Core library function that performs the actual notebook update by merging new fields into the library data and persisting it.
    updateNotebook(input: UpdateNotebookInput): NotebookEntry {
      const notebook = this.getNotebook(input.id);
      if (!notebook) {
        throw new Error(`Notebook not found: ${input.id}`);
      }
    
      log.info(`📝 Updating notebook: ${input.id}`);
    
      const updated = { ...this.library };
      const index = updated.notebooks.findIndex((n) => n.id === input.id);
    
      updated.notebooks[index] = {
        ...notebook,
        ...(input.name && { name: input.name }),
        ...(input.description && { description: input.description }),
        ...(input.topics && { topics: input.topics }),
        ...(input.content_types && { content_types: input.content_types }),
        ...(input.use_cases && { use_cases: input.use_cases }),
        ...(input.tags && { tags: input.tags }),
        ...(input.url && { url: input.url }),
      };
    
      this.saveLibrary(updated);
      log.success(`✅ Notebook updated: ${input.id}`);
    
      return updated.notebooks[index];
    }
  • TypeScript interface defining the input parameters for updating a notebook.
    export interface UpdateNotebookInput {
      id: string; // Required: which notebook to update
      name?: string;
      description?: string;
      topics?: string[];
      content_types?: string[];
      use_cases?: string[];
      tags?: string[];
      url?: string; // Allow changing URL
    }
  • MCP tool definition including name, description, and JSON input schema for registration.
        name: "update_notebook",
        description:
          `Update notebook metadata based on user intent.
    
    ## Pattern
    1) Identify target notebook and fields (topics, description, use_cases, tags, url)
    2) Propose the exact change back to the user
    3) After explicit confirmation, call this tool
    
    ## Examples
    - User: "React notebook also covers Next.js 14"
      You: "Add 'Next.js 14' to topics for React?"
      User: "Yes" → call update_notebook
    
    - User: "Include error handling in n8n description"
      You: "Update the n8n description to mention error handling?"
      User: "Yes" → call update_notebook
    
    Tip: You may update multiple fields at once if requested.`,
        inputSchema: {
          type: "object",
          properties: {
            id: {
              type: "string",
              description: "The notebook ID to update",
            },
            name: {
              type: "string",
              description: "New display name",
            },
            description: {
              type: "string",
              description: "New description",
            },
            topics: {
              type: "array",
              items: { type: "string" },
              description: "New topics list",
            },
            content_types: {
              type: "array",
              items: { type: "string" },
              description: "New content types",
            },
            use_cases: {
              type: "array",
              items: { type: "string" },
              description: "New use cases",
            },
            tags: {
              type: "array",
              items: { type: "string" },
              description: "New tags",
            },
            url: {
              type: "string",
              description: "New notebook URL",
            },
          },
          required: ["id"],
        },
      },
  • src/index.ts:201-214 (registration)
    Dispatch routing in main server that maps tool name to handler call.
    case "update_notebook":
      result = await this.toolHandlers.handleUpdateNotebook(
        args as {
          id: string;
          name?: string;
          description?: string;
          topics?: string[];
          content_types?: string[];
          use_cases?: string[];
          tags?: string[];
          url?: string;
        }
      );
      break;

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A3.7/5.0
Behavior2/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 of behavioral disclosure. It states that metadata is updated but does not explain overwrite vs. merge semantics, permissions, reversibility, or return behavior. The example says 'Add Next.js 14 to topics' while the schema says 'New topics list', leaving ambiguity about whether array fields replace or augment existing values.

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 front-loaded with a one-sentence purpose, followed by compact Pattern, Examples, and Tip sections. Each section earns its place, and the examples make the intended confirmation flow concrete without adding filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool is reasonably complete for an update operation because the pattern and examples specify the call flow and the schema documents all parameters. However, with no annotations and no output schema, important gaps remain: overwrite semantics are ambiguous and the description's field enumeration is incomplete, which could lead to incorrect invocation.

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%, so the baseline is 3. The description adds useful context by listing common fields and noting that multiple fields may be updated at once, but its field list omits name and content_types, and it does not clarify whether array parameters replace or merge with existing values.

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 operation: 'Update notebook metadata based on user intent' and identifies the resource and relevant fields. This distinguishes it from siblings like add_notebook, remove_notebook, and get_notebook because it is the only tool that mutates an existing notebook's metadata.

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?

The Pattern section provides explicit conditions: identify the target notebook and fields, propose the exact change back to the user, and only call the tool after explicit confirmation. The examples reinforce this confirmation workflow. It does not explicitly name alternatives or when not to use it, so it stops short of a 5.

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