Method and system for generating official business management user portrait based on Agent and MCP
The method for generating user profiles for public administration by combining Agent and MCP solves the problems of insufficient semantic understanding and low query accuracy in existing technologies, and realizes efficient and accurate data query and user profile generation in complex law enforcement scenarios, supporting law enforcement decision-making.
Patent Information
- Application Number
- CN202510956510.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-11
- Publication Date
- 2025-10-31
AI Technical Summary
Existing Text2SQL technology suffers from insufficient semantic understanding, limited query accuracy, and limited application of results in law enforcement scenarios, making it difficult to meet the data query and user profile generation needs in complex law enforcement scenarios.
A user profile generation method for public administration that combines Agent and MCP is adopted. Through question decomposition module, MCP parsing module, SQL generation module and data query module, it realizes semantic decomposition of natural language questions, multi-level context analysis and SQL statement generation, and generates structured user profile reports by combining user history records.
It improves the accuracy of semantic segmentation and context parsing in law enforcement scenarios, enhances the conversion accuracy of SQL queries, generates high-value user profile reports, and provides support for law enforcement decision-making.
Smart Images

Figure CN120873000A_ABST
Abstract
Description
Technical Field
[0001] This invention discloses a method and system for generating user profiles for government administration based on Agent and MCP, which relates to the field of data processing technology. Background Technology
[0002] With the development of big data and artificial intelligence technologies, the demand for data querying and analysis in fields such as public administration is increasing. Existing data query methods typically rely on professionals manually writing SQL statements, which is inefficient and requires a high level of expertise from operators. In recent years, Text2SQL technology has lowered the technical barrier by transforming user queries into SQL queries through natural language processing. However, existing Text2SQL technology has the following problems when handling queries in complex law enforcement scenarios:
[0003] 1. Insufficient semantic understanding: User questions often contain multi-layered contexts (such as time, location, and metrics), and existing models struggle to accurately break down and parse complex questions.
[0004] 2. Limited query accuracy: The lack of optimization for specific indicators in the law enforcement field (such as case handling rate and number of cases) results in insufficient accuracy of the generated SQL statements.
[0005] 3. Limited application of results: Existing technologies mainly focus on data querying and fail to further process the query results into high-value user profile reports, making it difficult to meet the needs of behavior analysis and decision support in law enforcement scenarios. Summary of the Invention
[0006] This invention addresses the problems of existing technologies by providing a method and system for generating user profiles for public administration based on Agent and MCP. This improves the accuracy of semantic segmentation and context parsing of natural language questions in law enforcement scenarios, enhances the accuracy of converting complex questions into SQL query statements, and generates law enforcement user profile reports based on query results to support law enforcement decision-making.
[0007] The specific solution proposed in this invention is as follows:
[0008] This invention provides a method for generating user profiles for government administration based on Agent and MCP, comprising:
[0009] Step 1: Construct a user profile generation system for government administration. This system includes a problem segmentation module, an MCP parsing module, an SQL generation module, a data query module, and a profile generation module.
[0010] Step 2: Based on the user's input natural language question, the question segmentation module uses the Agent to perform semantic segmentation on the user's natural language question, extract core entities, and identify the question type.
[0011] Step 3: Using the MCP parsing module in conjunction with the MCP model, perform multi-level contextual analysis on the split entities, supplement missing information, determine the sorting direction or calculation logic based on the problem type, and generate the parsing results of the MCP model.
[0012] Step 4: Based on the MCP parsing results, the SQL generation module calls the Text2SQL model to generate a standard SQL query statement.
[0013] Step 5: Execute the generated SQL statements through the database interface using the data query module, obtain the query results, and verify and clean the results to ensure data accuracy.
[0014] Step 6: Based on the query results, the profile generation module generates a structured user profile report by combining the user's historical query records and the characteristics of the public administration scenario.
[0015] Furthermore, in step 2 of the method for generating user profiles for civil administration based on Agent and MCP, the question decomposition module performs semantic decomposition on the questions based on the natural language processing model pre-trained by the Agent. The core entities extracted include time, location, and indicators, and the question types identified include ranking questions, percentage questions, direct query questions, year-on-year questions, and month-on-month questions.
[0016] Furthermore, in step 3 of the method for generating user profiles for public administration based on Agent and MCP, the parsing rules of the MCP model are optimized according to the domain knowledge base to ensure that the generated SQL statements conform to the database structure.
[0017] Furthermore, in step 6 of the method for generating user profiles for civil administration based on Agent and MCP, the user profile report generated by the profile generation module includes civil administration behavior patterns, key indicators of concern, and abnormal data analysis, and the user profile report is visualized to facilitate decision support.
[0018] This invention also provides a user profile generation system for public administration based on Agent and MCP. The system includes a problem segmentation module, an MCP parsing module, an SQL generation module, a data query module, and a profile generation module.
[0019] Based on the user's input in natural language, the question segmentation module uses an agent to perform semantic segmentation on the user's natural language question, extract core entities, and identify the question type.
[0020] The MCP parsing module combines the MCP model to perform multi-level contextual analysis on the split entities, supplementing missing information, determining the sorting direction or calculation logic based on the problem type, and generating the parsing results of the MCP model.
[0021] The SQL generation module uses the MCP parsing results to call the Text2SQL model to generate standard SQL query statements.
[0022] The data query module executes the generated SQL statements using the database interface, obtains the query results, and verifies and cleans the results to ensure data accuracy.
[0023] The profile generation module generates a structured user profile report based on the query results, combined with the user's historical query records and the characteristics of the public administration scenario.
[0024] Furthermore, the question segmentation module of the government administration user profile generation system based on Agent and MCP performs semantic segmentation of questions based on the natural language processing model pre-trained by Agent. The core entities extracted include time, location, and indicators, and the question types identified include ranking questions, percentage questions, direct query questions, year-on-year questions, and month-on-month questions.
[0025] Furthermore, the MCP parsing module of the aforementioned public administration user profile generation system based on Agent and MCP optimizes the parsing rules of the MCP model according to the domain knowledge base to ensure that the generated SQL statements conform to the database structure.
[0026] Furthermore, the user profile report generated by the profile generation module of the aforementioned Agent and MCP-based civil administration user profile generation system includes civil administration behavior patterns, key indicators of concern, and abnormal data analysis, and provides a visual output of the user profile report to facilitate decision support.
[0027] The advantages of this invention are:
[0028] High efficiency: By combining Agent and MCP, the efficiency of analyzing complex law enforcement issues and generating SQL is significantly improved, reducing the need for manual intervention.
[0029] Accuracy: Optimize parsing rules for law enforcement to generate SQL statements that conform to the database structure, thereby improving query accuracy.
[0030] Practicality: Generates law enforcement user profile reports, providing behavioral analysis and decision support for scenarios such as public administration.
[0031] Versatility: Supports multiple question types (ranking, percentage, year-on-year, month-on-month, direct query), suitable for diverse law enforcement data query needs.
[0032] User-friendly: Users do not need SQL knowledge; they can complete complex queries and generate profiles through natural language interaction. Attached Figure Description
[0033] Figure 1 This is a schematic diagram of the system application process of the present invention. Detailed Implementation
[0034] The present invention will be further described below with reference to the accompanying drawings and specific embodiments, so that those skilled in the art can better understand and implement the present invention. However, the embodiments described are not intended to limit the present invention.
[0035] Example 1
[0036] This invention provides a method for generating user profiles for government administration based on Agent and MCP, comprising:
[0037] Step 1: Construct a user profile generation system for government administration. This system includes a problem segmentation module, an MCP parsing module, an SQL generation module, a data query module, and a profile generation module.
[0038] Step 2: Based on the natural language question input by the user, the question splitting module uses the Agent to perform semantic splitting on the user's natural language question, extract core entities, and identify the question type.
[0039] The question segmentation module performs semantic segmentation of questions based on agent-pre-trained natural language processing models such as BERT or Grok. The core entities extracted include time, location, and metrics, and the question types identified include ranking questions, percentage questions, direct query questions, year-on-year questions, and month-on-month questions.
[0040] Step 3: Using the MCP parsing module in conjunction with the MCP (Multi-Context Parsing) model, perform multi-level context analysis on the split entities, supplement missing information, determine the sorting direction (ascending / descending) or calculation logic (proportion, year-on-year change) based on the question type, and generate the parsing results of the MCP model. The parsing rules of the MCP model can also be optimized based on the domain knowledge base to ensure that the generated SQL statements conform to the database structure.
[0041] Step 4: Based on the MCP parsing results, the SQL generation module calls the Text2SQL model to generate standard SQL query statements.
[0042] For ranking queries, the sorting logic is generated using the ROW_NUMBER() function. For direct metric queries, the query statement is generated directly instead of the calculation logic.
[0043] Step 5: Execute the generated SQL statements through the database interface using the data query module, obtain the query results, and verify and clean the results to ensure data accuracy.
[0044] Step 6: Based on the query results, the profile generation module generates a structured user profile report by combining the user's historical query records and the characteristics of the public administration scenario.
[0045] The user profile report generated by the profile generation module includes public administration behavior patterns, key indicators, and abnormal data analysis, and provides a visual output of the user profile report to facilitate decision support.
[0046] Example 2
[0047] This invention also provides a user profile generation system for public administration based on Agent and MCP. The system includes a problem segmentation module, an MCP parsing module, an SQL generation module, a data query module, and a profile generation module.
[0048] Based on the user's input in natural language, the question segmentation module uses an agent to perform semantic segmentation on the user's natural language question, extract core entities, and identify the question type.
[0049] The MCP parsing module combines the MCP model to perform multi-level contextual analysis on the split entities, supplementing missing information, determining the sorting direction or calculation logic based on the problem type, and generating the parsing results of the MCP model.
[0050] The SQL generation module uses the MCP parsing results to call the Text2SQL model to generate standard SQL query statements.
[0051] The data query module executes the generated SQL statements using the database interface, obtains the query results, and verifies and cleans the results to ensure data accuracy.
[0052] The profile generation module generates a structured user profile report based on the query results, combined with the user's historical query records and the characteristics of the public administration scenario.
[0053] The information interaction and execution process between the modules in the above system are based on the same concept as the method embodiment of the present invention, and the specific details can be found in the description in the method embodiment of the present invention, and will not be repeated here.
[0054] Similarly, the advantages of the system of the present invention are:
[0055] High efficiency: By combining Agent and MCP, the efficiency of analyzing complex law enforcement issues and generating SQL is significantly improved, reducing the need for manual intervention.
[0056] Accuracy: Optimize parsing rules for law enforcement to generate SQL statements that conform to the database structure, thereby improving query accuracy.
[0057] Practicality: Generates law enforcement user profile reports, providing behavioral analysis and decision support for scenarios such as public administration.
[0058] Versatility: Supports multiple question types (ranking, percentage, year-on-year, month-on-month, direct query), suitable for diverse law enforcement data query needs.
[0059] User-friendly: Users do not need SQL knowledge; they can complete complex queries and generate profiles through natural language interaction.
[0060] It should be noted that not all steps and modules in the above processes and system structures are mandatory; some steps or modules can be omitted as needed. The execution order of the steps is not fixed and can be adjusted as required. The system structures described in the above embodiments can be physical or logical structures. That is, some modules may be implemented by the same physical entity, or some modules may be implemented by multiple physical entities, or they may be implemented by certain components in multiple independent devices.
[0061] The above-described embodiments are merely preferred embodiments provided to fully illustrate the present invention, and the scope of protection of the present invention is not limited thereto. Equivalent substitutions or modifications made by those skilled in the art based on the present invention are all within the scope of protection of the present invention. The scope of protection of the present invention is defined by the claims.
Claims
1. A method for generating user profiles for public administration based on Agent and MCP, characterized by: include: Step 1: Construct a user profile generation system for government administration. This system includes a problem segmentation module, an MCP parsing module, an SQL generation module, a data query module, and a profile generation module. Step 2: Based on the user's input natural language question, the question segmentation module uses the Agent to perform semantic segmentation on the user's natural language question, extract core entities, and identify the question type. Step 3: Using the MCP parsing module in conjunction with the MCP model, perform multi-level contextual analysis on the split entities, supplement missing information, determine the sorting direction or calculation logic based on the problem type, and generate the parsing results of the MCP model. Step 4: Based on the MCP parsing results, the SQL generation module calls the Text2SQL model to generate a standard SQL query statement. Step 5: Execute the generated SQL statements through the database interface using the data query module, obtain the query results, and verify and clean the results to ensure data accuracy. Step 6: Based on the query results, the profile generation module generates a structured user profile report by combining the user's historical query records and the characteristics of the public administration scenario.
2. The method for generating user profiles for public administration based on Agent and MCP as described in claim 1, characterized in that: In step 2, the question segmentation module performs semantic segmentation on the questions based on the natural language processing model pre-trained by the Agent. The core entities extracted include time, location, and indicators. The identified question types include ranking questions, percentage questions, direct query questions, year-on-year questions, and month-on-month questions.
3. The method for generating user profiles for public administration based on Agent and MCP as described in claim 1, characterized in that: In step 3, the parsing rules of the MCP model are optimized based on the domain knowledge base to ensure that the generated SQL statements conform to the database structure.
4. The method for generating user profiles for public administration based on Agent and MCP as described in claim 1, characterized in that: In step 6, the user profile report generated by the profile generation module includes public administration behavior patterns, key indicators of concern, and abnormal data analysis. The user profile report is also visualized to facilitate decision support.
5. A user profile generation system for public administration based on Agent and MCP, characterized by: The system includes a problem decomposition module, an MCP parsing module, an SQL generation module, a data query module, and a profile generation module. Based on the user's input in natural language, the question segmentation module uses an agent to perform semantic segmentation on the user's natural language question, extract core entities, and identify the question type. The MCP parsing module combines the MCP model to perform multi-level contextual analysis on the split entities, supplementing missing information, determining the sorting direction or calculation logic based on the problem type, and generating the parsing results of the MCP model. The SQL generation module uses the MCP parsing results to call the Text2SQL model to generate standard SQL query statements. The data query module executes the generated SQL statements using the database interface, obtains the query results, and verifies and cleans the results to ensure data accuracy. The profile generation module generates a structured user profile report based on the query results, combined with the user's historical query records and the characteristics of the public administration scenario.
6. A public administration user profile generation system based on Agent and MCP as described in claim 5, characterized by the following problem: The splitting module performs semantic splitting of questions based on a pre-trained natural language processing model of the Agent. The core entities extracted include time, location, and indicators. The identified question types include ranking questions, percentage questions, direct query questions, year-on-year questions, and month-on-month questions.
7. The system for generating user profiles for public administration based on Agent and MCP as described in claim 5, characterized in that: The MCP parsing module optimizes the parsing rules of the MCP model based on the domain knowledge base to ensure that the generated SQL statements conform to the database structure.
8. A public administration user profile generation system based on Agent and MCP as described in claim 5, characterized in that: The user profile report generated by the profile generation module includes public administration behavior patterns, key indicators of concern, and abnormal data analysis, and provides a visual output of the user profile report to facilitate decision support.
Citation Information
Patent Citations
Portrayal recognition method based on block chain address, storage medium and electronic equipment
CN115391400A
Vertical field large model construction method and device based on 12345 data
CN117891826A
User portrait generation query method based on knowledge graph
CN119149755A
Query generation method in Text2SQL (Structured Query Language) task based on large language model
CN119938698A
Visualization method driven by SQL generation based on large model preference learning
CN120030036A
