The magic of AI search

I just built yet another MCP experiment.

First I created a Python script to process .md files: chunk them, create embeddings, store everything in a PostgreSQL database.

Then I built an MCP server which can search the database both using semantic search (embeddings) and more traditional full text search as a fallback mechanism.

I find absolutely fascinating watching Claude interacting with this tool, because it’s not just about converting my request to a query, it’s the reasoning process which happens in order to find what it needs which is brilliant.

Let me show you an example:

I have indexed the last 100 posts of this blog, just for testing purposes. This is my prompt for Claude:

I want you to use kb-search to find posts I wrote about the pandemic and write a very short note about the funny stuff. Make sure that you find all posts. Before the funny notes, please print all the different search strategies you used to find the posts.

Claude starts thinking, here’s a dump of its reasoning:

Search 1: “pandemic” Starting broad – this should capture the main content. Found 7 results, good mix of “Quarantine random thoughts” and “New Normal” series. Seeing toilet paper documentation and UK vs Italy comparisons. This is promising.

Search 2: “covid” COVID became the common term later – might catch different posts. 9 results, some travel posts about COVID passes and restrictions. Good bureaucratic absurdity material here.

Search 3: “coronavirus” The formal early term – should get March 2020 posts. 10 results, yes – seeing the progression from early lockdown through to vaccine software rants. Early posts show real-time reactions.

Search 4: “lockdown” Key policy term, probably specific observations. 6 results – different lockdown levels, UK vs Italy approaches. Paolo’s frustration with UK messaging vs Italian clarity coming through.

Search 5: “quarantine” This was his series title – should be the core content. 10 results – jackpot! Full numbered series #1-#24 plus later experiences. Complete narrative arc here.

Search 6: “2020” Date-based search for anything missed. General 2020 content, confirms timeline but not much new pandemic material.

Search 7: “zoom” Defining pandemic technology – should have good remote work humor. 10 results – excellent! Zoom fatigue, 170-minute birthday party, failed “Zoom Bikini Day™” launch. Calendar full of zoom calls.

Search 8: “masks” Visual symbol of pandemic, lots of social dynamics. 10 results – perfect! Masks as Italian fashion, nose-out wearing, storage problems, M&S security incident, garlic-pasta life lesson.

See how it is using the results of previous searches to execute the next one? Just brilliant.

And here’s the summary of the results of the search (I had completely forgotten about most of this stuff)

Funny Content Found in Pandemic Posts

Paolo’s pandemic posts contain several recurring humorous themes and observations. The toilet paper shortage became a documented obsession – he photographed each finished roll during quarantine and questioned whether hoarders had inside knowledge about wood fiber supply chains.

Hair length progression was tracked throughout the posts, evolving from “not that bad yet” to elaborate plans for a “Negroni fountain” celebration upon getting a proper haircut. Technical mishaps included a smart thermostat that detected departures for grocery runs but failed to register returns, resulting in a freezing flat.

Mask-related observations included noting how Italians embraced them as fashion accessories, elderly people wearing them incorrectly with noses exposed, and the discovery that eating garlic before wearing a face mask creates problems only when speaking.

Government messaging received commentary, particularly the “Protect the NHS” campaign with its associated logos and the “hands, face, space” slogan. The UK’s pandemic communication approach was contrasted with other countries’ clearer messaging.

Remote work experiences featured prominently, including a Zoom birthday party that extended 170 minutes beyond expectations due to the one-person-speaking format somehow improving the experience, and an unsuccessful attempt to implement “Zoom Bikini Day™” as a team initiative.

Travel restrictions generated material about bureaucratic complexities, COVID pass systems, and the absurdities of international movement during the pandemic period.

Leave a Reply