register_company
Create an employer account on ClawHire to post jobs, search candidates, and manage hiring. Provides session ID for subsequent operations and integrates with WonderCV infrastructure.
Instructions
注册成为 ClawHire 雇主,创建企业账号。
这是使用 ClawHire MCP 的第一步。注册成功后,您将获得:
session_id:用于所有后续操作的会话标识
公司账号:可发布职位、搜索候选人
Alpha 权限:前20家公司享受 generous 额度
如果该邮箱/手机号已关联 WonderCV 的 HrAccount,将自动关联现有账号。
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| company_name | Yes | 公司名称(中文),将映射到 Companies.cn | |
| Yes | HR/招聘负责人邮箱,用于接收候选人申请通知 | ||
| city | Yes | 公司所在城市,如:上海、北京、深圳 | |
| industry_id | No | 行业ID(可选),参考 WonderCV 行业分类 | |
| scale | No | 公司规模(可选),如:0-50人、50-150人、150-500人等 | |
| phone | No | 联系电话(可选),用于微信账号绑定 | |
| company_position | No | 您的职位(可选),如:HR经理、技术总监 |
Implementation Reference
- src/tools/register_company.ts:62-141 (handler)The main execute handler for the 'register_company' tool. It calls the backend API to register a company, creates a local session, and returns the registration result with session_id for subsequent tool calls.
async execute(input: Input) { try { // Call backend to register company const response = await registerCompany({ company_name: input.company_name, email: input.email, city: input.city, industry_id: input.industry_id, scale: input.scale, phone: input.phone, company_position: input.company_position, }); const { data } = response; // Create local session using backend-issued session_id const session = createSession( data.hr_account_token, data.company_token, data.tier as EmployerTier, data.session_id // Use backend session_id for auth continuity ); const tierConfig = getTierConfig(session); return { content: [ { type: 'text', text: JSON.stringify({ data: { company_token: data.company_token, hr_account_token: data.hr_account_token, is_new_account: data.is_new_account, verified: data.company.verified, company: { name: data.company.cn, city: input.city, scale: data.company.scale, }, message: data.is_new_account ? '公司注册成功!审核通过后可查看候选人完整信息。' : '已关联现有 WonderCV 账号,欢迎回来!', }, access: { tier: session.tier, daily_limits: tierConfig.daily_limits, }, meta: { session_id: session.session_id, }, next_steps: [ '使用 session_id 调用其他工具(已自动保存到会话)', '调用 post_job 发布职位', '调用 search_candidates 搜索候选人', ], }, null, 2), }, ], isError: false, }; } catch (error) { const errorMessage = error instanceof Error ? error.message : '注册失败'; return { content: [ { type: 'text', text: JSON.stringify({ error: { code: 'REGISTRATION_FAILED', message: errorMessage, }, hint: '请检查公司信息是否填写正确,或联系 support@wondercv.com', }, null, 2), }, ], isError: true, }; } }, - src/tools/register_company.ts:16-45 (schema)Zod input schema definition for the 'register_company' tool. Validates company_name, email, city, and optional fields like industry_id, scale, phone, and company_position.
const inputSchema = z.object({ company_name: z.string() .min(2, '公司名称至少需要2个字符') .max(100, '公司名称不能超过100个字符') .describe('公司名称(中文),将映射到 Companies.cn'), email: z.string() .email('请输入有效的邮箱地址') .describe('HR/招聘负责人邮箱,用于接收候选人申请通知'), city: z.string() .min(1, '请填写城市') .describe('公司所在城市,如:上海、北京、深圳'), industry_id: z.number() .optional() .describe('行业ID(可选),参考 WonderCV 行业分类'), scale: z.string() .optional() .describe('公司规模(可选),如:0-50人、50-150人、150-500人等'), phone: z.string() .optional() .describe('联系电话(可选),用于微信账号绑定'), company_position: z.string() .optional() .describe('您的职位(可选),如:HR经理、技术总监'), }); - src/tools/index.ts:28-57 (registration)Tool registry where 'register_company' is imported and exported. The registerCompanyTool is added to the allTools array, making it available to the MCP server.
import { registerCompanyTool } from './register_company.js'; import { postJobTool } from './post_job.js'; import { listJobsTool } from './list_jobs.js'; import { searchCandidatesTool } from './search_candidates.js'; import { viewCandidateTool } from './view_candidate.js'; import { listApplicationsTool } from './list_applications.js'; import { requestOutreachTool } from './request_outreach.js'; // Export all tools export { registerCompanyTool, postJobTool, listJobsTool, searchCandidatesTool, viewCandidateTool, listApplicationsTool, requestOutreachTool, }; // Tool registry for server initialization // eslint-disable-next-line @typescript-eslint/no-explicit-any export const allTools: Tool<any>[] = [ registerCompanyTool, postJobTool, listJobsTool, searchCandidatesTool, viewCandidateTool, listApplicationsTool, requestOutreachTool, ]; - src/backend-api.ts:117-144 (helper)Backend API helper for company registration. Defines RegisterCompanyInput/Output interfaces and the registerCompany function that makes the POST request to /employer/register endpoint.
export interface RegisterCompanyInput { company_name: string; industry_id?: number; city: string; scale?: string; email: string; phone?: string; company_position?: string; } export interface RegisterCompanyOutput { session_id: string; hr_account_token: string; company_token: string; is_new_account: boolean; tier: string; company: Company; hr_account: HrAccount; } export async function registerCompany( input: RegisterCompanyInput ): Promise<ApiResponse<RegisterCompanyOutput>> { return apiRequest('/employer/register', { method: 'POST', body: input, }); } - src/session.ts:49-67 (helper)Session creation helper used by register_company. Creates a new McpEmployerSession with the backend-issued session_id, hr_account_token, company_token, and tier information.
export function createSession( hrAccountToken: string, companyToken: string, tier: EmployerTier = 'alpha', backendSessionId?: string ): McpEmployerSession { const session: McpEmployerSession = { session_id: backendSessionId || generateSessionId(), hr_account_token: hrAccountToken, company_token: companyToken, tier, daily_usage: createDailyUsage(), last_active: new Date().toISOString(), created_at: new Date().toISOString(), }; sessions.set(session.session_id, session); return session; }