getAllCompanies
Retrieve company data from Mews hospitality platform with optional filters by ID, name, creation date, or update date for management and analysis.
Instructions
Returns all companies, optionally filtered by criteria
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| CompanyIds | No | Filter by specific company IDs | |
| Names | No | Filter by company names | |
| CreatedUtc | No | Date range filter for company creation | |
| UpdatedUtc | No | Date range filter for company updates | |
| Limitation | No | Pagination settings |
Implementation Reference
- The execute function implementing the core logic: parses input args, constructs request data with default limitation, calls mewsRequest to '/api/connector/v1/companies/getAll', and returns JSON stringified result.async execute(config: MewsAuthConfig, args: unknown): Promise<ToolResult> { const inputArgs = args as Record<string, unknown>; const requestData = { Limitation: { Count: 100 }, ...inputArgs }; const result = await mewsRequest(config, '/api/connector/v1/companies/getAll', requestData); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; }
- Input schema defining optional filters: CompanyIds, Names, CreatedUtc/UpdatedUtc ranges, and Limitation for pagination.inputSchema: { type: 'object', properties: { CompanyIds: { type: 'array', items: { type: 'string' }, description: 'Filter by specific company IDs', maxItems: 1000 }, Names: { type: 'array', items: { type: 'string' }, description: 'Filter by company names', maxItems: 1000 }, CreatedUtc: { type: 'object', properties: { StartUtc: { type: 'string', description: 'Start of creation date range (ISO 8601)' }, EndUtc: { type: 'string', description: 'End of creation date range (ISO 8601)' } }, description: 'Date range filter for company creation' }, UpdatedUtc: { type: 'object', properties: { StartUtc: { type: 'string', description: 'Start of update date range (ISO 8601)' }, EndUtc: { type: 'string', description: 'End of update date range (ISO 8601)' } }, description: 'Date range filter for company updates' }, Limitation: { type: 'object', properties: { Count: { type: 'number', description: 'Maximum number of companies to return' }, Cursor: { type: 'string', description: 'Pagination cursor for next page' } }, description: 'Pagination settings' } }, additionalProperties: false },
- src/tools/companies/getAllCompanies.ts:5-68 (registration)Exports the complete Tool object 'getAllCompaniesTool' with name, description, inputSchema, and execute handler.export const getAllCompaniesTool: Tool = { name: 'getAllCompanies', description: 'Returns all companies, optionally filtered by criteria', inputSchema: { type: 'object', properties: { CompanyIds: { type: 'array', items: { type: 'string' }, description: 'Filter by specific company IDs', maxItems: 1000 }, Names: { type: 'array', items: { type: 'string' }, description: 'Filter by company names', maxItems: 1000 }, CreatedUtc: { type: 'object', properties: { StartUtc: { type: 'string', description: 'Start of creation date range (ISO 8601)' }, EndUtc: { type: 'string', description: 'End of creation date range (ISO 8601)' } }, description: 'Date range filter for company creation' }, UpdatedUtc: { type: 'object', properties: { StartUtc: { type: 'string', description: 'Start of update date range (ISO 8601)' }, EndUtc: { type: 'string', description: 'End of update date range (ISO 8601)' } }, description: 'Date range filter for company updates' }, Limitation: { type: 'object', properties: { Count: { type: 'number', description: 'Maximum number of companies to return' }, Cursor: { type: 'string', description: 'Pagination cursor for next page' } }, description: 'Pagination settings' } }, additionalProperties: false }, async execute(config: MewsAuthConfig, args: unknown): Promise<ToolResult> { const inputArgs = args as Record<string, unknown>; const requestData = { Limitation: { Count: 100 }, ...inputArgs }; const result = await mewsRequest(config, '/api/connector/v1/companies/getAll', requestData); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; } };
- src/tools/index.ts:100-100 (registration)Includes getAllCompaniesTool in the allTools array for global tool registry.getAllCompaniesTool,
- src/tools/index.ts:15-15 (registration)Imports the getAllCompaniesTool from './companies/getAllCompanies.js'.import { getAllCompaniesTool } from './companies/getAllCompanies.js';