Skip to main content
Glama

convert_resume_text

Convert plain text resumes into structured JSON Resume format by automatically identifying sections like personal information, work experience, and education for easier editing and formatting.

Instructions

将纯文本格式的简历内容转换为标准JSON Resume格式。系统会智能识别简历中的各个部分(如个人信息、工作经历、教育背景等),并按照国际通用的JSON Resume标准进行结构化处理,方便后续编辑和格式转换。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
resumeTextYes

Implementation Reference

  • The MCP tool handler function for 'convert_resume_text'. It validates the input resumeText, calls novaCVService.convertTextToJsonResume(), formats the response using safeStringify, and handles errors by returning structured content.
    async ({ resumeText }, extra) => {
      if (!resumeText) {
        throw new Error("简历文本是必需的");
      }
      
      try {
        const result = await novaCVService.convertTextToJsonResume(resumeText);
        return {
          content: [
            {
              type: "text",
              text: safeStringify(result)
            }
          ],
        };
      } catch (error: any) {
        return {
          content: [
            {
              type: "text",
              text: `错误: ${error.message || "未知错误"}`
            }
          ],
        };
      }
    }
  • Core helper method in NovaCVService that performs the actual API call to convert plain resume text to JSON Resume format via POST /api/v1/resumes/convert-text, normalizes the response structure, and handles errors.
    async convertTextToJsonResume(resumeText: string): Promise<any> {
      try {
        console.log("开始转换简历文本为JSON格式");
        const response = await this.client.post('/api/v1/resumes/convert-text', {
          resumeText
        });
        console.log("转换API响应状态码:", response.status);
        console.log("转换API响应头:", JSON.stringify(response.headers, null, 2));
        console.log("转换API响应数据类型:", typeof response.data);
        
        // 如果直接返回简历数据,自动包装为标准格式
        if (response.data && typeof response.data === 'object') {
          // 检查是否缺少标准响应结构
          if (!response.data.success && !response.data.data && !response.data.error) {
            // 检查是否是简历数据结构
            if (response.data.basics || response.data.work || response.data.education) {
              return {
                success: true,
                data: {
                  jsonResume: response.data
                }
              };
            }
          } 
          // 标准化响应 - 确保jsonResume数据在一致的位置
          else if (response.data.success && response.data.data) {
            // 如果有data.resumeData但没有data.jsonResume,复制数据
            if (response.data.data.resumeData && !response.data.data.jsonResume) {
              response.data.data.jsonResume = response.data.data.resumeData;
            }
            // 如果有data.jsonResume但没有data.resumeData,复制数据
            else if (response.data.data.jsonResume && !response.data.data.resumeData) {
              response.data.data.resumeData = response.data.data.jsonResume;
            }
          }
        }
        
        return response.data;
      } catch (error) {
        console.error("转换简历文本失败:", error);
        this._handleError(error);
        throw error;
      }
    }
  • src/index.ts:229-261 (registration)
    Registration of the 'convert_resume_text' tool with the MCP server using server.tool(), including name, description, input schema, and handler reference.
    server.tool(
      "convert_resume_text",
      "将纯文本格式的简历内容转换为标准JSON Resume格式。系统会智能识别简历中的各个部分(如个人信息、工作经历、教育背景等),并按照国际通用的JSON Resume标准进行结构化处理,方便后续编辑和格式转换。",
      {
        resumeText: z.string()
      },
      async ({ resumeText }, extra) => {
        if (!resumeText) {
          throw new Error("简历文本是必需的");
        }
        
        try {
          const result = await novaCVService.convertTextToJsonResume(resumeText);
          return {
            content: [
              {
                type: "text",
                text: safeStringify(result)
              }
            ],
          };
        } catch (error: any) {
          return {
            content: [
              {
                type: "text",
                text: `错误: ${error.message || "未知错误"}`
              }
            ],
          };
        }
      }
    );
  • Zod input schema for the tool: requires a single string parameter 'resumeText'.
    {
      resumeText: z.string()
    },
  • Utility function safeStringify used in tool handlers to safely convert API responses to displayable strings, handling errors and special cases.
    const safeStringify = (data: any): string => {
      try {
        // 特别处理API错误响应
        if (data && data.error) {
          return `API错误: ${data.error.message || JSON.stringify(data.error)}`;
        }
        
        // 处理标准成功响应
        if (data && data.success === true && data.data) {
          const responseData = data.data;
          if (responseData.fileUrl) {
            return `简历生成成功,下载地址: ${responseData.fileUrl}`;
          }
        }
        
        // 默认JSON字符串化
        return JSON.stringify(data, null, 2);
      } catch (err) {
        return "API返回了结果,但无法转换为字符串展示(可能包含循环引用)";
      }
    };
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden. It mentions intelligent section recognition and international standard compliance, but lacks details about error handling, processing time, limitations (e.g., language support, format constraints), or what happens with malformed input. The behavioral disclosure is insufficient for a transformation tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately concise with two sentences that directly address the tool's function and benefits. It's front-loaded with the core purpose and avoids unnecessary elaboration, though the second sentence could be slightly more focused.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a single-parameter transformation tool with no annotations or output schema, the description provides basic purpose and parameter context but lacks sufficient behavioral details. It doesn't explain the output structure or potential errors, leaving gaps in understanding how the tool behaves in practice.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With only 1 parameter (resumeText) and 0% schema description coverage, the description compensates well by explaining what the parameter should contain: '纯文本格式的简历内容' (plain text format resume content). This adds meaningful context beyond the bare schema, though it doesn't specify format expectations or constraints.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: converting plain text resumes to JSON Resume format with intelligent section recognition. It specifies both the input (plain text) and output (structured JSON Resume), though it doesn't explicitly distinguish from sibling tools like 'analyze_resume_text' or 'generate_resume_from_text'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit guidance on when to use this tool versus alternatives. The description mentions it's for '方便后续编辑和格式转换' (facilitating subsequent editing and format conversion), but doesn't specify scenarios where this conversion is preferred over direct analysis or generation from text.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/HireTechUpUp/mcp-server-novacv'

If you have feedback or need assistance with the MCP directory API, please join our Discord server