Skip to main content
Glama

get_current_view_info

Retrieve details of the active view in Revit, including view type, name, and scale, to access current project context.

Instructions

获取 Revit 当前活动视图的详细信息,包括视图类型、名称、比例等属性。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler logic for the 'get_current_view_info' tool. It connects to Revit, sends the command, and returns the view information as JSON or an error message.
    async (args, extra) => {
      try {
        const response = await withRevitConnection(async (revitClient) => {
          return await revitClient.sendCommand("get_current_view_info", {});
        });
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(response, null, 2),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: `get current view info failed: ${
                error instanceof Error ? error.message : String(error)
              }`,
            },
          ],
        };
      }
    }
  • Registers the 'get_current_view_info' tool on the MCP server with name, description, empty input schema, and inline handler. This function is dynamically invoked by src/tools/register.ts.
    export function registerGetCurrentViewInfoTool(server: McpServer) {
      server.tool(
        "get_current_view_info",
        "获取 Revit 当前活动视图的详细信息,包括视图类型、名称、比例等属性。",
        {},
        async (args, extra) => {
          try {
            const response = await withRevitConnection(async (revitClient) => {
              return await revitClient.sendCommand("get_current_view_info", {});
            });
    
            return {
              content: [
                {
                  type: "text",
                  text: JSON.stringify(response, null, 2),
                },
              ],
            };
          } catch (error) {
            return {
              content: [
                {
                  type: "text",
                  text: `get current view info failed: ${
                    error instanceof Error ? error.message : String(error)
                  }`,
                },
              ],
            };
          }
        }
      );
    }
  • Central registration module that dynamically loads and registers all tools, including 'get_current_view_info' by calling registerGetCurrentViewInfoTool.
    export async function registerTools(server: McpServer) {
      // 获取当前文件的目录路径
      const __filename = fileURLToPath(import.meta.url);
      const __dirname = path.dirname(__filename);
    
      // 读取tools目录下的所有文件
      const files = fs.readdirSync(__dirname);
    
      // 过滤出.ts或.js文件,但排除index文件和register文件
      const toolFiles = files.filter(
        (file) =>
          (file.endsWith(".ts") || file.endsWith(".js")) &&
          file !== "index.ts" &&
          file !== "index.js" &&
          file !== "register.ts" &&
          file !== "register.js"
      );
    
      // 动态导入并注册每个工具
      for (const file of toolFiles) {
        try {
          // 构建导入路径
          const importPath = `./${file.replace(/\.(ts|js)$/, ".js")}`;
    
          // 动态导入模块
          const module = await import(importPath);
    
          // 查找并执行注册函数
          const registerFunctionName = Object.keys(module).find(
            (key) => key.startsWith("register") && typeof module[key] === "function"
          );
    
          if (registerFunctionName) {
            module[registerFunctionName](server);
            console.error(`已注册工具: ${file}`);
          } else {
            console.warn(`警告: 在文件 ${file} 中未找到注册函数`);
          }
        } catch (error) {
          console.error(`注册工具 ${file} 时出错:`, error);
        }
      }
    }
  • src/index.ts:14-14 (registration)
    Invocation of the tools registration in the main server setup.
    await registerTools(server);
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool retrieves information ('获取...详细信息'), implying it's a read-only operation, but doesn't confirm this or describe other traits like error handling, performance, or output format. For a tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.

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

Conciseness5/5

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

The description is a single, efficient sentence in Chinese that clearly states the tool's purpose and lists example attributes. It's front-loaded with the main action and resource, with no wasted words or redundant information.

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?

Given the tool has 0 parameters, no annotations, and no output schema, the description is moderately complete. It specifies what information is retrieved (view details with examples) but lacks details on the return format, error cases, or how it interacts with Revit context. For a simple read operation, this is adequate but has clear gaps in behavioral context.

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?

The tool has 0 parameters, and schema description coverage is 100%, so there are no parameters to document. The description doesn't need to add parameter semantics, and a baseline score of 4 is appropriate as it doesn't introduce confusion or omissions regarding inputs.

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: '获取 Revit 当前活动视图的详细信息' (get detailed information about Revit's current active view). It specifies the verb ('获取' - get) and resource ('当前活动视图' - current active view), and lists example attributes ('视图类型、名称、比例等属性' - view type, name, scale, etc.). However, it doesn't explicitly differentiate from sibling tools like 'get_current_view_elements', which appears to be related but focuses on elements rather than view properties.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention any prerequisites, exclusions, or compare it to sibling tools such as 'get_current_view_elements' or 'get_available_family_types'. The context is implied (when you need view details in Revit), but there are no explicit usage instructions.

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/mcp-servers-for-revit/revit-mcp'

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