pohoda_create_address
Add new contacts or companies to the POHODA address book with required name and optional details like address, ID numbers, and contact information.
Instructions
Create a new address/contact in POHODA addressbook. Requires name; optional fields: street, city, zip, IČO, DIČ, email, phone, web, note.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Company or contact name (required) | |
| street | No | Street address | |
| city | No | City | |
| zip | No | ZIP/postal code | |
| ico | No | IČO (company ID number) | |
| dic | No | DIČ (VAT ID) | |
| No | Email address | ||
| phone | No | Phone number | |
| web | No | Website URL | |
| note | No | Note or comment |
Implementation Reference
- src/tools/addresses.ts:48-90 (handler)The implementation of 'pohoda_create_address' tool, including its registration, input validation schema using Zod, and the handler function that builds the XML import document and sends it to the POHODA client.
"pohoda_create_address", "Create a new address/contact in POHODA addressbook. Requires name; optional fields: street, city, zip, IČO, DIČ, email, phone, web, note.", { name: z.string().describe("Company or contact name (required)"), street: z.string().optional().describe("Street address"), city: z.string().optional().describe("City"), zip: z.string().optional().describe("ZIP/postal code"), ico: z.string().optional().describe("IČO (company ID number)"), dic: z.string().optional().describe("DIČ (VAT ID)"), email: z.string().optional().describe("Email address"), phone: z.string().optional().describe("Phone number"), web: z.string().optional().describe("Website URL"), note: z.string().optional().describe("Note or comment"), }, async (params) => { try { const xml = buildImportDoc({ ico: client.ico }, (item) => { const adb = item.ele(NS.adb, "adb:addressbook").att("version", "2.0"); const header = adb.ele(NS.adb, "adb:addressbookHeader"); header.ele(NS.adb, "adb:addressbookType").txt("company"); const identity = header.ele(NS.adb, "adb:identity"); const typAddr = identity.ele(NS.typ, "typ:address"); typAddr.ele(NS.typ, "typ:name").txt(params.name); if (params.street) typAddr.ele(NS.typ, "typ:street").txt(params.street); if (params.city) typAddr.ele(NS.typ, "typ:city").txt(params.city); if (params.zip) typAddr.ele(NS.typ, "typ:zip").txt(params.zip); if (params.ico) typAddr.ele(NS.typ, "typ:ico").txt(params.ico); if (params.dic) typAddr.ele(NS.typ, "typ:dic").txt(params.dic); if (params.email) header.ele(NS.adb, "adb:email").txt(params.email); if (params.phone) header.ele(NS.adb, "adb:phone").txt(params.phone); if (params.web) header.ele(NS.adb, "adb:web").txt(params.web); if (params.note) header.ele(NS.adb, "adb:note").txt(params.note); }); const response = await client.sendXml(xml); const result = extractImportResult(parseResponse(response)); return result.success ? ok(`Address created successfully. ${result.producedId != null ? `ID: ${result.producedId}` : result.message}`) : err(result.message); } catch (e) { return err((e as Error).message); } } );