Skip to main content
Glama
LZMW

Aurai Advisor (上级顾问 MCP)

by LZMW

sync_context

Upload .md or .txt files to provide project context to the senior AI advisor, ensuring complete content delivery without truncation.

Instructions

同步代码上下文(支持上传 .md 和 .txt 文件,避免内容被截断)

在第一次调用或上下文发生重大变化时使用,让上级AI了解当前项目的整体情况。


🎯 典型使用场景

场景 1:上传文章供上级顾问评审

sync_context(
    operation='full_sync',
    files=['文章.md'],
    project_info={
        'task': 'article_review',
        'target_platform': 'GLM Coding 知识库'
    }
)
consult_aurai(
    problem_type='other',
    error_message='请评审以下投稿文章...',
    context={'请查看已上传的文章文件': '已通过 sync_context 上传'}
)

场景 2:上传代码文件(避免内容被截断)⭐ 重要

# 问题:代码太长,在 context 字段中可能被截断
# 解决:将代码转换为 .txt 文件后上传

import shutil

# 步骤 1:将代码文件复制为 .txt
shutil.copy('src/main.py', 'src/main.txt')

# 步骤 2:上传文件
sync_context(
    operation='incremental',
    files=['src/main.txt'],
    project_info={
        'description': '需要调试的代码',
        'language': 'Python'
    }
)

# 步骤 3:告诉上级顾问文件已上传
consult_aurai(
    problem_type='runtime_error',
    error_message='请审查已上传的 src/main.txt 文件,帮我找出bug',
    context={
        'file_location': '已通过 sync_context 上传',
        'expected_behavior': '应该输出...',
        'actual_behavior': '实际输出...'
    }
)

优势

  • ✅ 避免代码在 contextanswers_to_questions 字段中被截断

  • ✅ 利用 sync_context 的文件读取机制,完整传递内容

  • ✅ 上级顾问可以完整读取代码文件

场景 3:项目首次初始化

sync_context(
    operation='full_sync',
    files=['README.md', 'docs/说明文档.md'],
    project_info={
        'project_name': 'My Project',
        'tech_stack': 'Python + FastAPI'
    }
)

[注意] 文件上传限制

files 参数只支持 .txt 和 .md 文件!

  • [OK] 支持:README.md, docs.txt, notes.md 等文本和Markdown文件

  • [X] 不支持:.py, .js, .json, .yaml 等代码文件

使用场景

  1. full_sync: 完整同步,适合首次调用或项目重大变更

  2. incremental: 增量同步,适合添加新文件或更新

  3. clear: 清空对话历史

Token优化

当 project_info 中的单个字段超过 800 tokens 时,会自动:

  • 缓存到临时文件

  • 在对话历史中记录文件路径

  • 发送给上级AI时仍会读取完整内容

参数说明

  • operation: 操作类型(full_sync/incremental/clear)

  • files: 文件路径列表,只能是 .txt 或 .md 文件

  • project_info: 项目信息字典,可包含任意字段

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
operationYes操作类型: full_sync(完整同步), incremental(增量添加), clear(清空历史)
filesNo**⚠️ 只支持 .txt 和 .md 文件!** 如需上传代码文件(.py/.js/.json等),必须先复制为 .txt。示例: shutil.copy('script.py', 'script.txt') 然后传 files=['script.txt']。文件路径列表(支持 JSON 字符串或列表,会自动解析)
project_infoNo项目信息字典,可包含项目名称、技术栈、任务描述等任意字段(支持 JSON 字符串或字典,会自动解析)

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/LZMW/mcp-aurai-server'

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