export default function customerTools(pi) {
pi.registerTool({
name: 'lookup_customer',
label: 'Look up customer',
description: 'Look up a customer using their stable customer ID.',
parameters: {
type: 'object',
properties: {
customerId: {
type: 'string',
description: 'Stable customer identifier.',
},
},
required: ['customerId'],
additionalProperties: false,
},
async execute(_toolCallId, { customerId }, _signal, _onUpdate, ctx) {
const source = ctx.external?.provider ?? 'api';
return {
content: [
{
type: 'text',
text: `Customer ${customerId} requested from ${source}.`,
},
],
details: {
customerId,
source,
},
};
},
});
}