feat: inject live notebook names into tool descriptions and add graceful fallback#45
Open
autojack-bot[bot] wants to merge 4 commits into
Open
feat: inject live notebook names into tool descriptions and add graceful fallback#45autojack-bot[bot] wants to merge 4 commits into
autojack-bot[bot] wants to merge 4 commits into
Conversation
…ful fallback On connect/init, fetch the notebook list and cache it. The ListTools handler injects the available notebook names into the notebookName field descriptions of evernote_create_note and evernote_update_note, so agents know exactly what notebooks are valid before writing. When a notebookName is passed that doesn't exist: - First tries to auto-create the notebook - Falls back to the default notebook if creation fails - Includes a clear warning in the response either way Also adds notebookName support to evernote_update_note so notes can be moved between notebooks with the same graceful fallback behavior. Closes #44
Apply config({ quiet: true }) consistently to install-to-claude.js and
auth-standalone.ts, matching the pattern already in index.ts. Add a unit
test that enforces the quiet flag is present in all runtime entrypoints.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves the Evernote MCP server’s notebook UX by (1) surfacing live notebook names directly in tool argument descriptions during tool discovery, and (2) making notebookName handling in note create/update resilient by auto-creating missing notebooks and falling back to the default notebook when creation fails.
Changes:
- Added notebook caching +
list_toolsenrichment to inject live notebook names (and default) intoevernote_create_note/evernote_update_noteargument descriptions. - Implemented “missing notebook” behavior: auto-create on demand; if creation fails, fall back to default notebook and warn in tool output.
- Extended Zod schemas to reject empty/whitespace-only
notebookName, and addednotebookNamesupport toUpdateNoteSchemaplus unit tests.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/tool-schemas.ts | Tightens validation for notebookName (trim + non-empty) and adds notebookName to update schema. |
| src/notebook-tool-descriptions.ts | New helper to resolve notebook cache for discovery and inject notebook names into tool schemas. |
| src/index.ts | Implements notebook cache, discovery-time enrichment, and notebook fallback logic for create/update note. |
| src/auth-standalone.ts | Loads dotenv with quiet: true. |
| scripts/install-to-claude.js | Loads dotenv with quiet: true. |
| tests/unit/tool-schemas.test.ts | Adds unit coverage for UpdateNoteSchema rejecting empty notebookName. |
| tests/unit/notebook-tool-descriptions.test.ts | Adds unit coverage for discovery-time notebook resolution + schema enrichment. |
| tests/unit/dotenv-quiet.test.ts | Ensures runtime entrypoints use quiet dotenv loading. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #44
Summary
Notebook-aware tool descriptions: On API init and on first
ListToolscall, the server fetches the notebook list and injects available notebook names directly into thenotebookNamefield descriptions ofevernote_create_noteandevernote_update_note. Agents see e.g.Available notebooks: "Personal", "Work", "Inbox". Default: "Personal".before they write anything.Graceful fallback for unknown notebooks: When a
notebookNameis passed that doesn't match any existing notebook:⚠️note in the response that it was created.notebookNameadded toevernote_update_note: Allows moving a note to a different notebook via the update tool. Same fallback logic applies.Implementation
src/index.ts: AddednotebookCache,refreshNotebookCache(), background seeding inensureAPI(), dynamicListToolsRequestSchemahandler, and updatedcreate_note/update_notehandlers.src/tool-schemas.ts: AddednotebookName: z.string().optional()toUpdateNoteSchema.Test plan
npm run build)npm test)list_toolsreturnsnotebookNamedescriptions with actual notebook namescreate_noteauto-creates it or falls back gracefully