| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- class PrepareHeadhaulDocumentUploadTool:
- name = 'prepare_headhaul_document_upload'
- route_path = '/mcp/tools/prepareHeadhaulDocumentUpload'
- def __init__(self, api_client=None):
- self.api_client = api_client
- def metadata(self):
- return {
- 'name': self.name,
- 'description': (
- '使用场景:用户要上传头程文档文件且已在对话窗口添加该文件时,'
- '先确认添加文档类型,再调用本工具签发一次性上传槽位。'
- '签发后由宿主把窗口里的文件 POST 到返回的上传地址,并带上upload_token。'
- '禁止使用:选文件框、把文件内容放进工具参数、打开独立上传页、'
- '改走报关资料或订单附件、让用户去 home 后台上传。'
- '参数只用于工具内部调用;最终回答只能展示中文业务名称。'
- ),
- 'input_schema': {
- 'type': 'object',
- 'properties': {
- 'document_type_id': {
- 'type': 'integer',
- 'minimum': 1,
- 'description': (
- '要添加的文档类型。必须先调用'
- 'list_headhaul_document_filter_options并选择“添加文档类型”。'
- ),
- },
- },
- 'required': ['document_type_id'],
- 'additionalProperties': False,
- },
- }
- def call(
- self,
- document_type_id,
- request_id='rq_prepare_headhaul_document_upload',
- ):
- if self.api_client is None:
- raise RuntimeError(
- 'api client is required for prepare_headhaul_document_upload'
- )
- if (
- isinstance(document_type_id, bool)
- or not isinstance(document_type_id, int)
- or document_type_id < 1
- ):
- raise ValueError('document_type_id is invalid')
- return self.api_client.call_tool(
- self.name,
- self.route_path,
- {'document_type_id': document_type_id},
- request_id,
- )
|