How to use the blog posts from a WordPress as a tool?

Describe the problem/error/question

I’m trying to use our WordPress blog as a source of data. I know that there is an option to getAllPost but when I tried to use it, I got an error. I’m wondering if anyone has an example or an idea of how to do it. I have shared my current flow below.

What is the error message (if any)?

This is the error I got:

There was an error:

“The workflow did not return an item with the property ‘response’”

Please share your workflow

Share the output returned by the last node

Information on your n8n setup

  • n8n version: Cloud (ouruser.app.n8n.cloud)
  • Database (default: SQLite): Cloud
  • n8n EXECUTIONS_PROCESS setting (default: own, main): Cloud
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Cloud
  • Operating system: N/A

Hey @fanmixco,

you need to set the “response” variable as the last node in your sub-workflow, similar to this:

Also, I noticed that in your tool name and description, you are introducing the tools to the agent as made for publishing a blog post, not reading from the blog.

That will likely cause the agent to still malfunction after the response issue has been fixed.

Thanks for the suggestion, I did some changes based on the two comments, but I got a new issue:

This is the new message I’m telling instead of the posting that was my mistake:

Call this tool to retrieve a blog entry from the WordPress API. The following parameters are required in JSON format:

  • content - the main body content of the blog entry

Thank you.

Ok, for the use as a tool, you need to return a single string as the value for “response”.

Since you are getting multiple blog posts, you need to combine the content of the list of blog posts returned by the WP-node into one string.

After using Google translate to figure out what you are asking the AI agent to do, you probably need a completely different approach to getting this to work.
It’s called RAG (Retrieval Augmented Generation).

Here’s a tutorial that covers all the basics and also includes a specific implementation using n8n:

Awesome! I was able to more or less make it work, do you have an advise what should I do to get only the content section?

The current algorithm was able to get my everything:

This is the new flow to retrieve data from WordPress and store it in the DB:

Thank you.

Use the set node at the end to format the data output

Hi @Imperol, are you think I don’t need the vectorized DB as @automaze.me suggested? I think his previous proposal seems quite legit.

Both will work. I prefer vectors for large datasets. For simple data I’d just use the tool

Any suggestion @automaze.me how could I get only the content? Thanks.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.