Skip to main content
Glama
el95149

Baloosearch MCP Server

by el95149

show_file_words

Retrieve indexed words and metadata from files using KDE's Baloo search system to analyze content and properties of specific documents.

Instructions

Show indexed content & meta-data in a file using KDE balooshow.

This tool retrieves all the indexed words & meta-data from a specific file that has been indexed by KDE's Baloo search system.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesThe absolute path to the file to show indexed words & meta-data for

Implementation Reference

  • MCP tool handler that invokes the showFileWords helper, serializes results to JSON, and handles errors.
    async ({ path }) => { try { const results = await showFileWords({ path }) return { content: [{ type: "text", text: JSON.stringify(results, null, 2) }] } } catch (error) { return { content: [{ type: "text", text: `Error showing file words: ${error.message}` }] } } }
  • Zod input schema defining the 'path' parameter for the tool.
    { path: z.string().describe("The absolute path to the file to show indexed words & meta-data for") },
  • Registration of the 'show_file_words' tool with MCP server, including description, input schema, and handler function.
    server.tool( "show_file_words", `Show indexed content & meta-data in a file using KDE balooshow. This tool retrieves all the indexed words & meta-data from a specific file that has been indexed by KDE's Baloo search system.`, { path: z.string().describe("The absolute path to the file to show indexed words & meta-data for") }, async ({ path }) => { try { const results = await showFileWords({ path }) return { content: [{ type: "text", text: JSON.stringify(results, null, 2) }] } } catch (error) { return { content: [{ type: "text", text: `Error showing file words: ${error.message}` }] } } } )
  • Helper function that runs 'balooshow -x' command to extract indexed words from a file and returns path and words array.
    export async function showFileWords({ path }) { // Validate inputs if (!path || typeof path !== 'string') { throw new Error('Path is required and must be a string') } // Build the balooshow command let command = `balooshow -x "${path}"` try { // Execute the command const { stdout, stderr } = await execPromise(command) // Parse the output const lines = stdout.trim().split('\n').filter(line => line.length > 0) // Filter out any empty lines or error messages const words = lines.filter(line => !line.startsWith('Elapsed:') && line.trim() !== '') return { path: path, words: words } } catch (error) { throw new Error(`Failed to execute balooshow: ${error.message}`) } }

Other Tools

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/el95149/baloosearch-mcp'

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