|
@@ -17,6 +17,8 @@ import { userTools } from './tools/user-tools.js';
|
|
|
import { roleTools } from './tools/role-tools.js';
|
|
import { roleTools } from './tools/role-tools.js';
|
|
|
import { systemConfigTools } from './tools/system-config-tools.js';
|
|
import { systemConfigTools } from './tools/system-config-tools.js';
|
|
|
import { orderTools } from './tools/order-tools.js';
|
|
import { orderTools } from './tools/order-tools.js';
|
|
|
|
|
+import { areaTools } from './tools/area-tools.js';
|
|
|
|
|
+import { companyTools } from './tools/company-tools.js';
|
|
|
import { authTools } from './tools/auth-tools.js';
|
|
import { authTools } from './tools/auth-tools.js';
|
|
|
import { getApiClient } from './services/api-client.js';
|
|
import { getApiClient } from './services/api-client.js';
|
|
|
|
|
|
|
@@ -574,6 +576,279 @@ Error Handling:
|
|
|
- Returns "Error: Resource not found" if order ID doesn't exist`,
|
|
- Returns "Error: Resource not found" if order ID doesn't exist`,
|
|
|
targetServer
|
|
targetServer
|
|
|
);
|
|
);
|
|
|
|
|
+
|
|
|
|
|
+ // Area management tools
|
|
|
|
|
+ registerToolWithAnnotations(
|
|
|
|
|
+ areaTools.areaList,
|
|
|
|
|
+ { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
|
|
|
+ 'List Areas',
|
|
|
|
|
+ `List and search geographic areas (provinces, cities, districts) with pagination.
|
|
|
|
|
+
|
|
|
|
|
+This tool retrieves a paginated list of areas from the admin system.
|
|
|
|
|
+Supports keyword search, sorting, and filtering.
|
|
|
|
|
+
|
|
|
|
|
+Args:
|
|
|
|
|
+ - page (number): Page number, starting from 1 (default: 1)
|
|
|
|
|
+ - pageSize (number): Number of items per page, 1-100 (default: 20)
|
|
|
|
|
+ - keyword (string): Optional search keyword
|
|
|
|
|
+ - sortBy (string): Optional field to sort by
|
|
|
|
|
+ - sortOrder (string): Sort direction: "ASC" or "DESC" (default: "DESC")
|
|
|
|
|
+ - filters (string): Optional filter conditions as JSON string
|
|
|
|
|
+ - response_format (string): Output format: "markdown" or "json" (default: "markdown")
|
|
|
|
|
+
|
|
|
|
|
+Returns:
|
|
|
|
|
+ Paginated list of areas with id, name, code, level, parentId, status.
|
|
|
|
|
+
|
|
|
|
|
+Examples:
|
|
|
|
|
+ - Use when: "List all areas" -> params with page=1, pageSize=20
|
|
|
|
|
+
|
|
|
|
|
+Error Handling:
|
|
|
|
|
+ - Returns "Error: Permission denied" if not authorized`,
|
|
|
|
|
+ targetServer
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ registerToolWithAnnotations(
|
|
|
|
|
+ areaTools.areaGet,
|
|
|
|
|
+ { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
|
|
|
+ 'Get Area by ID',
|
|
|
|
|
+ `Retrieve detailed information about a specific area by ID.
|
|
|
|
|
+
|
|
|
|
|
+Args:
|
|
|
|
|
+ - id (number): Area ID (required)
|
|
|
|
|
+
|
|
|
|
|
+Returns:
|
|
|
|
|
+ Complete area information.
|
|
|
|
|
+
|
|
|
|
|
+Examples:
|
|
|
|
|
+ - Use when: "Get area with ID 1" -> params with id=1
|
|
|
|
|
+
|
|
|
|
|
+Error Handling:
|
|
|
|
|
+ - Returns "Error: Resource not found" if area ID doesn't exist`,
|
|
|
|
|
+ targetServer
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ registerToolWithAnnotations(
|
|
|
|
|
+ areaTools.areaGetTree,
|
|
|
|
|
+ { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
|
|
|
+ 'Get Area Tree',
|
|
|
|
|
+ `Get the complete hierarchical tree structure of all geographic areas.
|
|
|
|
|
+
|
|
|
|
|
+This tool returns areas organized as a tree (provinces -> cities -> districts).
|
|
|
|
|
+Useful for displaying region selectors or analyzing geographic hierarchy.
|
|
|
|
|
+
|
|
|
|
|
+Args:
|
|
|
|
|
+ - None
|
|
|
|
|
+
|
|
|
|
|
+Returns:
|
|
|
|
|
+ Hierarchical tree structure with nested children arrays.
|
|
|
|
|
+
|
|
|
|
|
+Examples:
|
|
|
|
|
+ - Use when: "Get all provinces and cities" or "Show area tree"
|
|
|
|
|
+
|
|
|
|
|
+Error Handling:
|
|
|
|
|
+ - Returns "Error: Permission denied" if not authorized`,
|
|
|
|
|
+ targetServer
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ registerToolWithAnnotations(
|
|
|
|
|
+ areaTools.areaCreate,
|
|
|
|
|
+ { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
|
|
|
|
|
+ 'Create Area',
|
|
|
|
|
+ `Create a new geographic area (province, city, or district).
|
|
|
|
|
+
|
|
|
|
|
+Args:
|
|
|
|
|
+ - name (string): Area name (required)
|
|
|
|
|
+ - code (string): Area code e.g. BJS, ZJS (required)
|
|
|
|
|
+ - level (number): Area level: 1=province, 2=city, 3=district (required)
|
|
|
|
|
+ - parentId (number): Parent area ID (required for cities and districts)
|
|
|
|
|
+ - status (number): Status: 0 = disabled, 1 = enabled (optional)
|
|
|
|
|
+
|
|
|
|
|
+Returns:
|
|
|
|
|
+ Created area information with ID.
|
|
|
|
|
+
|
|
|
|
|
+Examples:
|
|
|
|
|
+ - Use when: "Create a new province" -> params with name="New Province", code="NWP", level=1
|
|
|
|
|
+
|
|
|
|
|
+Error Handling:
|
|
|
|
|
+ - Returns "Error: Data already exists" if code is duplicated`,
|
|
|
|
|
+ targetServer
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ registerToolWithAnnotations(
|
|
|
|
|
+ areaTools.areaUpdate,
|
|
|
|
|
+ { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
|
|
|
|
|
+ 'Update Area',
|
|
|
|
|
+ `Update an existing geographic area.
|
|
|
|
|
+
|
|
|
|
|
+Args:
|
|
|
|
|
+ - id (number): Area ID to update (required)
|
|
|
|
|
+ - name (string): Area name (optional)
|
|
|
|
|
+ - code (string): Area code (optional)
|
|
|
|
|
+ - level (number): Area level (optional)
|
|
|
|
|
+ - status (number): Status: 0 = disabled, 1 = enabled (optional)
|
|
|
|
|
+
|
|
|
|
|
+Returns:
|
|
|
|
|
+ Updated area information.
|
|
|
|
|
+
|
|
|
|
|
+Examples:
|
|
|
|
|
+ - Use when: "Update area name" -> params with id=1, name="New Name"
|
|
|
|
|
+
|
|
|
|
|
+Error Handling:
|
|
|
|
|
+ - Returns "Error: Resource not found" if area ID doesn't exist`,
|
|
|
|
|
+ targetServer
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ registerToolWithAnnotations(
|
|
|
|
|
+ areaTools.areaDelete,
|
|
|
|
|
+ { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: false },
|
|
|
|
|
+ 'Delete Area',
|
|
|
|
|
+ `Delete a geographic area by ID.
|
|
|
|
|
+
|
|
|
|
|
+Args:
|
|
|
|
|
+ - id (number): Area ID to delete (required)
|
|
|
|
|
+
|
|
|
|
|
+Returns:
|
|
|
|
|
+ Deletion confirmation.
|
|
|
|
|
+
|
|
|
|
|
+Examples:
|
|
|
|
|
+ - Use when: "Delete area with ID 10" -> params with id=10
|
|
|
|
|
+
|
|
|
|
|
+Error Handling:
|
|
|
|
|
+ - Returns "Error: Resource not found" if area ID doesn't exist`,
|
|
|
|
|
+ targetServer
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ // Company management tools
|
|
|
|
|
+ registerToolWithAnnotations(
|
|
|
|
|
+ companyTools.companyList,
|
|
|
|
|
+ { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
|
|
|
+ 'List Companies',
|
|
|
|
|
+ `List and search companies with pagination and filtering.
|
|
|
|
|
+
|
|
|
|
|
+This tool retrieves a paginated list of companies from the admin system.
|
|
|
|
|
+Supports keyword search, sorting, and filtering.
|
|
|
|
|
+
|
|
|
|
|
+Args:
|
|
|
|
|
+ - page (number): Page number, starting from 1 (default: 1)
|
|
|
|
|
+ - pageSize (number): Number of items per page, 1-100 (default: 20)
|
|
|
|
|
+ - keyword (string): Optional search keyword for company name
|
|
|
|
|
+ - sortBy (string): Optional field to sort by
|
|
|
|
|
+ - sortOrder (string): Sort direction: "ASC" or "DESC" (default: "DESC")
|
|
|
|
|
+ - filters (string): Optional filter conditions as JSON string
|
|
|
|
|
+ - response_format (string): Output format: "markdown" or "json" (default: "markdown")
|
|
|
|
|
+
|
|
|
|
|
+Returns:
|
|
|
|
|
+ For JSON format: Structured data with schema:
|
|
|
|
|
+ {
|
|
|
|
|
+ "total": number,
|
|
|
|
|
+ "count": number,
|
|
|
|
|
+ "current": number,
|
|
|
|
|
+ "pageSize": number,
|
|
|
|
|
+ "companies": [...],
|
|
|
|
|
+ "has_more": boolean
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+Examples:
|
|
|
|
|
+ - Use when: "List all companies" -> params with page=1, pageSize=20
|
|
|
|
|
+ - Use when: "Search for company Zhongzhi" -> params with keyword="Zhongzhi"
|
|
|
|
|
+
|
|
|
|
|
+Error Handling:
|
|
|
|
|
+ - Returns "Error: Permission denied" if not authorized`,
|
|
|
|
|
+ targetServer
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ registerToolWithAnnotations(
|
|
|
|
|
+ companyTools.companyGet,
|
|
|
|
|
+ { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
|
|
|
+ 'Get Company by ID',
|
|
|
|
|
+ `Retrieve detailed information about a specific company by ID.
|
|
|
|
|
+
|
|
|
|
|
+Args:
|
|
|
|
|
+ - id (number): Company ID (required)
|
|
|
|
|
+
|
|
|
|
|
+Returns:
|
|
|
|
|
+ Complete company information.
|
|
|
|
|
+
|
|
|
|
|
+Examples:
|
|
|
|
|
+ - Use when: "Get company with ID 1" -> params with id=1
|
|
|
|
|
+
|
|
|
|
|
+Error Handling:
|
|
|
|
|
+ - Returns "Error: Resource not found" if company ID doesn't exist`,
|
|
|
|
|
+ targetServer
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ registerToolWithAnnotations(
|
|
|
|
|
+ companyTools.companyCreate,
|
|
|
|
|
+ { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
|
|
|
|
|
+ 'Create Company',
|
|
|
|
|
+ `Create a new company in the admin system.
|
|
|
|
|
+
|
|
|
|
|
+Args:
|
|
|
|
|
+ - companyName (string): Company name (required)
|
|
|
|
|
+ - contactPerson (string): Contact person name (optional)
|
|
|
|
|
+ - contactPhone (string): Contact phone number (optional)
|
|
|
|
|
+ - contactEmail (string): Contact email (optional)
|
|
|
|
|
+ - address (string): Company address (optional)
|
|
|
|
|
+ - platformId (number): Platform ID (optional)
|
|
|
|
|
+ - status (number): Status: 0 = disabled, 1 = enabled (optional)
|
|
|
|
|
+
|
|
|
|
|
+Returns:
|
|
|
|
|
+ Created company information with ID.
|
|
|
|
|
+
|
|
|
|
|
+Examples:
|
|
|
|
|
+ - Use when: "Create a new company" -> params with companyName="ABC Corp"
|
|
|
|
|
+
|
|
|
|
|
+Error Handling:
|
|
|
|
|
+ - Returns "Error: Data already exists" if company name is duplicated`,
|
|
|
|
|
+ targetServer
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ registerToolWithAnnotations(
|
|
|
|
|
+ companyTools.companyUpdate,
|
|
|
|
|
+ { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
|
|
|
|
|
+ 'Update Company',
|
|
|
|
|
+ `Update an existing company.
|
|
|
|
|
+
|
|
|
|
|
+Args:
|
|
|
|
|
+ - id (number): Company ID to update (required)
|
|
|
|
|
+ - companyName (string): Company name (optional)
|
|
|
|
|
+ - contactPerson (string): Contact person name (optional)
|
|
|
|
|
+ - contactPhone (string): Contact phone number (optional)
|
|
|
|
|
+ - contactEmail (string): Contact email (optional)
|
|
|
|
|
+ - address (string): Company address (optional)
|
|
|
|
|
+ - platformId (number): Platform ID (optional)
|
|
|
|
|
+ - status (number): Status: 0 = disabled, 1 = enabled (optional)
|
|
|
|
|
+
|
|
|
|
|
+Returns:
|
|
|
|
|
+ Updated company information.
|
|
|
|
|
+
|
|
|
|
|
+Examples:
|
|
|
|
|
+ - Use when: "Update company contact" -> params with id=1, contactPerson="John Doe"
|
|
|
|
|
+
|
|
|
|
|
+Error Handling:
|
|
|
|
|
+ - Returns "Error: Resource not found" if company ID doesn't exist`,
|
|
|
|
|
+ targetServer
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ registerToolWithAnnotations(
|
|
|
|
|
+ companyTools.companyDelete,
|
|
|
|
|
+ { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: false },
|
|
|
|
|
+ 'Delete Company',
|
|
|
|
|
+ `Delete a company by ID.
|
|
|
|
|
+
|
|
|
|
|
+Args:
|
|
|
|
|
+ - id (number): Company ID to delete (required)
|
|
|
|
|
+
|
|
|
|
|
+Returns:
|
|
|
|
|
+ Deletion confirmation.
|
|
|
|
|
+
|
|
|
|
|
+Examples:
|
|
|
|
|
+ - Use when: "Delete company with ID 10" -> params with id=10
|
|
|
|
|
+
|
|
|
|
|
+Error Handling:
|
|
|
|
|
+ - Returns "Error: Resource not found" if company ID doesn't exist`,
|
|
|
|
|
+ targetServer
|
|
|
|
|
+ );
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// ============================================================================
|
|
// ============================================================================
|