Skip to content
← Public packages

@kody/doordash

Order food on DoorDash as a customer through the consumer MCP used by dd-cli.

src/find-items.ts

21 lines · 668 B · TypeScript
import { callMcpTool, TOOLS, type DoorDashMcpAuthInput } from './mcp.ts'

export type FindItemsInput = DoorDashMcpAuthInput & {
	storeId: string | number
	query: string | string[]
	dryRun?: boolean
}

export default async function findItems(input: FindItemsInput) {
	const storeId = String(input.storeId ?? '').trim()
	if (!storeId) throw new Error('storeId is required.')
	const query = Array.isArray(input.query)
		? input.query.map(String)
		: [String(input.query ?? '').trim()]
	if (!query.length || !query[0]) throw new Error('query is required.')
	return callMcpTool({
		...input,
		name: TOOLS.findItemsInStore,
		arguments: { store_id: storeId, query },
	})
}