001-obsidian-mcp-bundle #1
@@ -21,10 +21,70 @@ export async function registerSearchTools(server: ObsidianMCPServer): Promise<vo
|
||||
server.registerTool(
|
||||
'obsidian_search',
|
||||
'Search vault for text. Returns matching files or optionally match counts using `total` flag. Supports path filtering, result limits, case sensitivity, and multiple output formats (text/json).',
|
||||
{ type: 'object', properties: {} },
|
||||
{
|
||||
type: 'object',
|
||||
required: ['query'],
|
||||
properties: {
|
||||
query: {
|
||||
type: 'string',
|
||||
description: 'Search query text (required)',
|
||||
},
|
||||
path: {
|
||||
type: 'string',
|
||||
description: 'Limit search to folder path (optional)',
|
||||
},
|
||||
limit: {
|
||||
type: 'number',
|
||||
description: 'Maximum number of results to return (optional)',
|
||||
},
|
||||
total: {
|
||||
type: 'boolean',
|
||||
description: 'Return match count instead of file list (optional)',
|
||||
},
|
||||
case: {
|
||||
type: 'boolean',
|
||||
description: 'Case sensitive search (optional)',
|
||||
},
|
||||
format: {
|
||||
type: 'string',
|
||||
enum: ['text', 'json'],
|
||||
description: 'Output format (optional, default: text)',
|
||||
},
|
||||
},
|
||||
},
|
||||
createToolHandler(
|
||||
'Search vault for text',
|
||||
{ type: 'object', properties: {} },
|
||||
{
|
||||
type: 'object',
|
||||
required: ['query'],
|
||||
properties: {
|
||||
query: {
|
||||
type: 'string',
|
||||
description: 'Search query text (required)',
|
||||
},
|
||||
path: {
|
||||
type: 'string',
|
||||
description: 'Limit search to folder path (optional)',
|
||||
},
|
||||
limit: {
|
||||
type: 'number',
|
||||
description: 'Maximum number of results to return (optional)',
|
||||
},
|
||||
total: {
|
||||
type: 'boolean',
|
||||
description: 'Return match count instead of file list (optional)',
|
||||
},
|
||||
case: {
|
||||
type: 'boolean',
|
||||
description: 'Case sensitive search (optional)',
|
||||
},
|
||||
format: {
|
||||
type: 'string',
|
||||
enum: ['text', 'json'],
|
||||
description: 'Output format (optional, default: text)',
|
||||
},
|
||||
},
|
||||
},
|
||||
async (args) => {
|
||||
const validated = searchSchema.parse(args) as any;
|
||||
const sanitized = sanitizeParameters(validated) as any;
|
||||
|
||||
Reference in New Issue
Block a user