@kody/notion-mcp
src/search.ts
22 lines · 471 B · TypeScriptimport { notionMcpSetupMessage, callNotionMcp, firstArray } from './mcp.ts'
type Input = { query?: string }
export default async function searchNotion(input: Input = {}) {
const mcp = await callNotionMcp(
[
"search",
"notion-search",
"API-post-search"
],
{ query: input.query?.trim() || undefined },
)
if (!mcp) {
throw new Error(notionMcpSetupMessage())
}
return {
via: 'mcp',
tool: mcp.tool,
results: firstArray(mcp.result) ?? mcp.result,
}
}