Documentation for Admin Intents, show that to invoke “Edit Metaobject Definition”, we need to pass the Metaobject Definition ID as per the example.
const activity = await shopify.intents.invoke(
'edit:shopify/MetaobjectDefinition',
{value: 'gid://shopify/MetaobjectDefinition/123456789'},
);
const response = await activity.complete;
if (response.code === 'ok') {
console.log('Metaobject definition updated:', response.data);
}
However while trying to use this structure, I got an error.
[
{
"code": "invalid_type",
"expected": "string",
"received": "undefined",
"path": [
"type"
],
"message": "Required"
}
]
Turns out, edit:shopify/MetaobjectDefinition expects a type like data: { type: definition.type }, and not {value: 'gid://shopify/MetaobjectDefinition/123456789'},
This behavior matches what edit:shopify/Metaobject expects. However the documentation needs to be updated/corrected to Indicate that type is needed and not the ID.