Docs
Servidor MCPHerramientas disponibles

Crear gasto

Crea un gasto operativo de la organización.

Herramienta MCPcreate_expense

Propósito

Crea un gasto operativo de la organización.

Usar cuando
Debe registrarse un nuevo gasto del negocio.
No usar cuando
Necesitas cambiar su liquidación o eliminarlo.
Permisos requeridos
expenses:manage
Efectos secundarios
Modifica datos
Idempotencia
Idempotente

Esquema de entrada

JSON Schema
{  "type": "object",  "properties": {    "idempotencyKey": {      "type": "string",      "minLength": 1,      "maxLength": 200,      "description": "Unique retry key for this exact operation. Reuse it only when retrying the same request."    },    "input": {      "oneOf": [        {          "type": "object",          "properties": {            "description": {              "$ref": "#/definitions/__schema0"            },            "amount": {              "$ref": "#/definitions/__schema1"            },            "categoryName": {              "$ref": "#/definitions/__schema2"            },            "locationId": {              "$ref": "#/definitions/__schema3"            },            "businessDate": {              "$ref": "#/definitions/__schema4"            },            "notes": {              "$ref": "#/definitions/__schema5"            },            "supplierId": {              "type": "string"            },            "settlementMode": {              "type": "string",              "const": "paid"            },            "paymentForm": {              "type": "string",              "enum": [                "12",                "13",                "14",                "15",                "17",                "23",                "24",                "25",                "26",                "27",                "28",                "29",                "30",                "31",                "99",                "02",                "06",                "01",                "05",                "04",                "03",                "08"              ],              "description": "Active SAT payment-form code.",              "x-exac-sat-catalog": "payment-forms"            }          },          "required": [            "description",            "amount",            "categoryName",            "businessDate",            "settlementMode",            "paymentForm"          ],          "additionalProperties": false        },        {          "type": "object",          "properties": {            "description": {              "$ref": "#/definitions/__schema0"            },            "amount": {              "$ref": "#/definitions/__schema1"            },            "categoryName": {              "$ref": "#/definitions/__schema2"            },            "locationId": {              "$ref": "#/definitions/__schema3"            },            "businessDate": {              "$ref": "#/definitions/__schema4"            },            "notes": {              "$ref": "#/definitions/__schema5"            },            "supplierId": {              "type": "string"            },            "settlementMode": {              "type": "string",              "const": "credit"            },            "paymentForm": {              "type": "string",              "const": "99"            },            "settlementTerms": {              "type": "object",              "properties": {                "installmentCount": {                  "type": "integer",                  "minimum": 1,                  "maximum": 60                },                "firstDue": {                  "oneOf": [                    {                      "type": "object",                      "properties": {                        "kind": {                          "type": "string",                          "const": "transaction_date"                        }                      },                      "required": [                        "kind"                      ],                      "additionalProperties": false                    },                    {                      "type": "object",                      "properties": {                        "kind": {                          "type": "string",                          "const": "months_after_transaction"                        },                        "months": {                          "type": "integer",                          "minimum": 1,                          "maximum": 60                        }                      },                      "required": [                        "kind",                        "months"                      ],                      "additionalProperties": false                    },                    {                      "type": "object",                      "properties": {                        "kind": {                          "type": "string",                          "const": "fixed_date"                        },                        "date": {                          "type": "string"                        }                      },                      "required": [                        "kind",                        "date"                      ],                      "additionalProperties": false                    }                  ]                },                "recurrence": {                  "oneOf": [                    {                      "type": "object",                      "properties": {                        "kind": {                          "type": "string",                          "const": "anchor_day"                        }                      },                      "required": [                        "kind"                      ],                      "additionalProperties": false                    },                    {                      "type": "object",                      "properties": {                        "kind": {                          "type": "string",                          "const": "day_of_month"                        },                        "day": {                          "type": "integer",                          "minimum": 1,                          "maximum": 31                        }                      },                      "required": [                        "kind",                        "day"                      ],                      "additionalProperties": false                    },                    {                      "type": "object",                      "properties": {                        "kind": {                          "type": "string",                          "const": "last_day"                        }                      },                      "required": [                        "kind"                      ],                      "additionalProperties": false                    }                  ]                }              },              "required": [                "installmentCount",                "firstDue",                "recurrence"              ],              "additionalProperties": false            }          },          "required": [            "description",            "amount",            "categoryName",            "businessDate",            "supplierId",            "settlementMode",            "paymentForm",            "settlementTerms"          ],          "additionalProperties": false        }      ]    }  },  "required": [    "idempotencyKey",    "input"  ],  "$schema": "http://json-schema.org/draft-07/schema#",  "additionalProperties": false,  "definitions": {    "__schema0": {      "type": "string",      "minLength": 1    },    "__schema1": {      "type": "number",      "exclusiveMinimum": 0    },    "__schema2": {      "type": "string",      "minLength": 1    },    "__schema3": {      "type": "string"    },    "__schema4": {      "type": "string",      "pattern": "^\\d{4}-\\d{2}-\\d{2}$",      "description": "Accounting date in YYYY-MM-DD format"    },    "__schema5": {      "type": "string"    }  }}

Esquema de salida

JSON Schema
{  "type": "object",  "properties": {    "data": {      "type": "object",      "properties": {        "documentRef": {          "type": "string",          "pattern": "^expense:.+$"        },        "settlementMode": {          "type": "string",          "enum": [            "credit",            "paid"          ]        }      },      "required": [        "documentRef",        "settlementMode"      ],      "additionalProperties": false    },    "error": {      "$schema": "http://json-schema.org/draft-07/schema#",      "type": "object",      "properties": {        "code": {          "type": "string",          "enum": [            "validation_error",            "unauthenticated",            "forbidden",            "not_found",            "method_not_allowed",            "conflict",            "idempotency_conflict",            "operation_in_progress",            "recovery_required",            "rate_limited",            "provider_unavailable",            "internal"          ]        },        "message": {          "type": "string"        },        "details": {          "type": "object",          "properties": {            "issues": {              "type": "array",              "items": {                "type": "object",                "properties": {                  "path": {                    "type": "array",                    "items": {                      "anyOf": [                        {                          "type": "string"                        },                        {                          "type": "number"                        }                      ]                    }                  },                  "message": {                    "type": "string"                  },                  "code": {                    "type": "string"                  }                },                "required": [                  "path",                  "message"                ],                "additionalProperties": false              }            },            "retryable": {              "type": "boolean"            },            "retryAfterSeconds": {              "type": "integer",              "exclusiveMinimum": 0,              "maximum": 9007199254740991            }          },          "additionalProperties": false        }      },      "required": [        "code",        "message"      ],      "additionalProperties": false    }  },  "$schema": "http://json-schema.org/draft-07/schema#",  "additionalProperties": false,  "oneOf": [    {      "required": [        "data"      ]    },    {      "required": [        "error"      ]    }  ]}

Flujo relacionado

Consulta los flujos canónicos en la introducción

Herramientas relacionadas