foodblock-mcp

v0.5.1
io.github.FoodXDevelopment/foodblock-mcp Checked 1 hour ago Published 9 months ago

Food data tools for any AI agent.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

foodblock_create Create FoodBlock

Create a new FoodBlock. A FoodBlock is the universal data primitive for the food system. It has three fields: type (what it is), state (its properties), refs (what it references). Base types: actor (person/org), place (location), substance (ingredient/product), transform (cooking/processing), transfer (sale/delivery), observe (review/certification). Use dot notation for subtypes: actor.producer, substance.product, observe.review, etc.

ParameterTypeDescription
type *stringBlock type. Base types: actor, place, substance, transform, transfer, observe. Use dot notation for subtypes, e.g. actor.producer, substance.product, transfer.order
refsobjectReferences to other blocks by hash. Example: { seller: 'abc123...' }
stateobjectThe block's properties as a JSON object. Example: { name: 'Sourdough', price: 4.50 }

foodblock_update Update FoodBlock

Create a new version of an existing FoodBlock. FoodBlocks are append-only — this creates a new block that references the previous one via refs.updates. Note: state is a FULL REPLACEMENT, not a merge.

ParameterTypeDescription
previous_hash *stringThe hash of the block to update (64-character hex string)
type *stringThe block type (must match the original)
refsobjectAdditional refs (updates ref is added automatically)
stateobjectThe new state (full replacement, not a merge)

foodblock_get Get FoodBlock

Fetch a specific FoodBlock by its SHA-256 hash.

ParameterTypeDescription
hash *stringThe 64-character hex hash of the block to retrieve

foodblock_query Query FoodBlocks

Search for FoodBlocks by type, ref, or heads. Returns matching blocks.

ParameterTypeDescription
heads_onlybooleanIf true, only return head blocks (latest version in each chain)
limitnumberMaximum results to return (default 20)
ref_rolestringFilter by ref role name. Use with ref_value. Example: 'seller'
ref_valuestringFilter by ref value (a block hash). Use with ref_role.
typestringFilter by type (exact or prefix). Examples: 'actor', 'substance.product'

foodblock_chain Trace Provenance Chain

Follow the update chain of a FoodBlock backwards through its versions. Shows the full version history: current → previous → original.

ParameterTypeDescription
hash *stringThe hash of the block to trace backwards from
max_depthnumberMaximum chain depth to traverse (default 50)

foodblock_tree Trace Provenance Tree

Build the full provenance tree for a FoodBlock by following ALL refs recursively. Shows the complete story: bread ← baking ← flour ← wheat ← farm.

ParameterTypeDescription
hash *stringThe hash of the block to build the provenance tree from
max_depthnumberMaximum tree depth (default 10)

foodblock_heads List Head Blocks

List all head blocks (latest version of each entity/item). Optionally filter by type.

ParameterTypeDescription
typestringOptional type filter (e.g. 'substance.product')

foodblock_info FoodBlock System Info

Get an overview of the FoodBlock system: server info, block count, and protocol summary. Call this first to understand what data is available.

foodblock_create_agent Create AI Agent

Register a new AI agent in the FoodBlock system. The agent gets its own identity, Ed25519 keypair, and can sign blocks. Every agent must have an operator — the human or business it acts for. IMPORTANT: Save the returned credentials — they cannot be recovered after server restart.

ParameterTypeDescription
name *stringName for the agent, e.g. 'Bakery Assistant'
operator_hash *stringHash of the actor this agent works for
capabilitiesarrayAgent capabilities
modelstringAI model, e.g. 'claude-sonnet'

foodblock_load_agent Load Agent

Load a previously created agent using saved credentials. Required after MCP server restart to restore signing ability.

ParameterTypeDescription
agent_hash *stringThe agent's block hash (from foodblock_create_agent)
private_key *stringThe agent's private key hex (from foodblock_create_agent credentials)
public_keystringThe agent's public key hex (optional, for verification)

foodblock_agent_draft Create Agent Draft

Create a draft FoodBlock on behalf of an agent. Draft blocks have state.draft=true. The human operator can approve or reject with foodblock_approve_draft.

ParameterTypeDescription
agent_hash *stringHash of the agent creating this draft
type *stringBlock type, e.g. 'transfer.order'
refsobjectBlock refs
stateobjectBlock state

foodblock_approve_draft Approve Agent Draft

Approve a draft block created by an agent. Creates a confirmed version with draft removed.

ParameterTypeDescription
draft_hash *stringHash of the draft block to approve

foodblock_list_agents List Agents

List all AI agents in the FoodBlock system.

foodblock_tombstone Tombstone FoodBlock

Mark a FoodBlock for content erasure (GDPR compliance). Creates an observe.tombstone block that references the target. The target block's state is replaced with {tombstoned: true}. The hash, type, and refs are preserved for chain integrity.

ParameterTypeDescription
requested_by *stringHash of the actor requesting erasure
target_hash *stringHash of the block to tombstone (64-character hex string)
reasonstringReason for erasure (e.g. 'gdpr_erasure', 'user_request')

foodblock_validate Validate FoodBlock

Validate a FoodBlock against its declared schema or a provided schema. Returns an array of error messages (empty means valid). Checks required fields, types, expected refs, and instance_id requirements.

ParameterTypeDescription
type *stringBlock type to validate
refsobjectBlock refs to validate
stateobjectBlock state to validate

foodblock_batch Batch Create FoodBlocks

Create multiple FoodBlocks in a single request. Blocks are sorted in dependency order automatically. Useful for syncing offline-created blocks or bulk imports. Returns counts of inserted, skipped (duplicates), and failed blocks.

ParameterTypeDescription
blocks *arrayArray of blocks to create, each with type, state, refs

foodblock_fb Natural Language FoodBlock

The single natural language entry point to FoodBlock. Describe food in plain English and get structured FoodBlocks back. No need to know types, fields, or hashes. Examples: 'Sourdough bread, $4.50, organic, contains gluten', 'Amazing pizza at Luigi\'s, 5 stars', 'Green Acres Farm, 200 acres, organic wheat in Oregon', 'Walk-in cooler temperature 4 celsius', 'Ordered 50kg flour from Stone Mill'.

ParameterTypeDescription
text *stringAny food-related natural language text