Skip to main content
Glama
cwente25

Knowledge Base MCP Server

by cwente25

get_note

Retrieve the full content of a specific note from your knowledge base by providing its category path and title.

Instructions

Retrieve the full content of a specific note

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
category_pathYesCategory path (e.g., 'work/clients/acme')
titleYesNote title (can use full filename or friendly title)

Implementation Reference

  • The handler function that executes the 'get_note' tool. It extracts arguments, calls storage.get_note, formats the note with metadata, and returns formatted TextContent.
    async def handle_get_note(arguments: dict) -> list[TextContent]:
        """Handle get_note tool call."""
        try:
            category_path = arguments["category_path"]
            title = arguments["title"]
    
            # Get note
            note = storage.get_note(category_path, title)
    
            # Format output with frontmatter
            output = f"# {note.title}\n\n"
            output += f"**Category:** {note.category or 'root'}\n"
            output += f"**Tags:** {', '.join(note.frontmatter.tags) if note.frontmatter.tags else 'none'}\n"
            output += f"**Date:** {note.frontmatter.date}\n"
    
            if note.frontmatter.updated:
                output += f"**Updated:** {note.frontmatter.updated}\n"
    
            # Add metadata if any
            if note.frontmatter.metadata:
                output += "\n**Additional Info:**\n"
                for key, value in note.frontmatter.metadata.items():
                    output += f"- {key}: {value}\n"
    
            output += f"\n---\n\n{note.content}"
    
            return [TextContent(type="text", text=output)]
        except (NoteNotFoundError, StorageError) as e:
            return [TextContent(type="text", text=str(e))]
        except Exception as e:
            return [TextContent(type="text", text=f"❌ Error: {str(e)}")]
  • Input schema definition for the 'get_note' tool, specifying required category_path and title parameters.
    Tool(
        name="get_note",
        description="Retrieve the full content of a specific note",
        inputSchema={
            "type": "object",
            "properties": {
                "category_path": {
                    "type": "string",
                    "description": "Category path (e.g., 'work/clients/acme')",
                },
                "title": {
                    "type": "string",
                    "description": "Note title (can use full filename or friendly title)",
                },
            },
            "required": ["category_path", "title"],
        },
    ),
  • Dispatch logic in the main call_tool function that routes 'get_note' calls to the handle_get_note handler.
    elif name == "get_note":
        return await handle_get_note(arguments)
  • Core storage method that retrieves a note by computing the file path and parsing the markdown file into a Note object. Called by the handler.
    def get_note(self, category_path: str, title: str) -> Note:
        """
        Retrieve a note by category path and title.
    
        Args:
            category_path: Category path (e.g., "work/clients/acme")
            title: Note title (can be friendly name or filename)
    
        Returns:
            Note object
    
        Raises:
            NoteNotFoundError: If note doesn't exist
        """
        normalized = normalize_path(category_path)
        file_path = self._get_note_path(normalized, title)
    
        if not file_path.exists():
            raise NoteNotFoundError(
                f"❌ Error: Note '{title}' not found in {normalized or 'root'}/\n"
                f"💡 Tip: Use search_notes to find existing notes"
            )
    
        return self._parse_note_file(file_path)

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/cwente25/KnowledgeBaseMCP'

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