kibela_search_notes
Retrieve notes from Kibela by specifying a search query and applying filters for co-editing, archive, sort, users, or folders.
Instructions
Search Kibela notes with given query
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search query | |
| coediting | No | Filter by co-editing status | |
| isArchived | No | Filter by archive status | |
| sortBy | No | Sort by (RELEVANT, CONTENT_UPDATED_AT) | |
| userIds | No | Filter by user IDs | |
| folderIds | No | Filter by folder IDs |
Implementation Reference
- src/kibela.ts:228-302 (handler)The handler case for 'kibela_search_notes' in the CallToolRequestSchema. It extracts query parameters, executes the GraphQL search query via the client, filters out null documents, and returns the results as JSON.
case "kibela_search_notes": { const { query, coediting, isArchived, sortBy, userIds, folderIds } = args as { query: string; coediting?: boolean; isArchived?: boolean; sortBy?: string; userIds?: string[]; folderIds?: string[]; }; const operation = ` query SearchNotes( $query: String!, $coediting: Boolean, $isArchived: Boolean, $sortBy: SearchSortKind, $userIds: [ID!], $folderIds: [ID!] ) { search( query: $query, first: 15, coediting: $coediting, isArchived: $isArchived, sortBy: $sortBy, userIds: $userIds, folderIds: $folderIds ) { edges { node { document { ... on Note { id title url contentUpdatedAt author { id account realName } groups { id name } } } } } } } `; const response = await client.request<SearchResponse>(operation, { query, coediting, isArchived, sortBy, userIds, folderIds, }); const notes = response.search.edges .filter((edge) => edge.node.document !== null) .map((edge) => edge.node.document); return { content: [ { type: "text", text: JSON.stringify(notes, null, 2), }, ], }; } - src/kibela.ts:28-43 (schema)The SEARCH_NOTES_TOOL definition with name 'kibela_search_notes', description, and inputSchema (query, coediting, isArchived, sortBy, userIds, folderIds).
const SEARCH_NOTES_TOOL: Tool = { name: "kibela_search_notes", description: "Search Kibela notes with given query", inputSchema: { type: "object", properties: { query: { type: "string", description: "Search query" }, coediting: { type: "boolean", description: "Filter by co-editing status" }, isArchived: { type: "boolean", description: "Filter by archive status" }, sortBy: { type: "string", description: "Sort by (RELEVANT, CONTENT_UPDATED_AT)" }, userIds: { type: "array", items: { type: "string" }, description: "Filter by user IDs" }, folderIds: { type: "array", items: { type: "string" }, description: "Filter by folder IDs" }, }, required: ["query"], }, }; - src/kibela.ts:206-221 (registration)Tool registration in ListToolsRequestSchema handler, where SEARCH_NOTES_TOOL is listed in the tools array.
server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [ SEARCH_NOTES_TOOL, GET_MY_NOTES_TOOL, GET_NOTE_CONTENT_TOOL, GET_GROUPS_TOOL, GET_GROUP_FOLDERS_TOOL, GET_GROUP_NOTES_TOOL, GET_FOLDER_NOTES_TOOL, GET_USERS_TOOL, LIKE_NOTE_TOOL, UNLIKE_NOTE_TOOL, GET_RECENTLY_VIEWED_NOTES_TOOL, GET_NOTE_FROM_PATH_TOOL, ], })); - src/types.ts:68-76 (helper)The SearchResponse type definition used as the response type for the search GraphQL query.
export interface SearchResponse { search: { edges: Array<{ node: { document: KibelaNote | null; }; }>; }; }