Skip to main content
Glama

get_element_info

Retrieve detailed information about Revit elements, including properties and parameters, by specifying the element ID to analyze model components.

Instructions

获取 Revit 元素的详细信息

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
elementIdYes元素的 ID
getItemPropertyInfoNo是否获取元素属性信息
getItemParameterInfoNo是否获取元素参数信息

Implementation Reference

  • The main handler method for the 'get_element_info' tool in the RevitService class. It delegates the request to the RevitSocketClient.
    async getElementInfo(args: GetElementInfoArgs): Promise<any> { try { return await this.client.getElementInfo(args); } catch (error) { console.error('[RevitService] 获取元素信息失败:', error); throw error; } }
  • Socket client handler that sends the 'get_element_info' command with arguments to the Revit plugin via socket.
    public async getElementInfo(args: GetElementInfoArgs): Promise<any> { return await this.sendRequest('get_element_info', args); }
  • src/index.ts:175-197 (registration)
    Tool registration in the ListToolsRequestSchema handler, defining the tool name, description, and input schema.
    name: "get_element_info", description: "获取 Revit 元素的详细信息", inputSchema: { type: "object", properties: { elementId: { type: "string", description: "元素的 ID" }, getItemPropertyInfo: { type: "boolean", description: "是否获取元素属性信息", default: true }, getItemParameterInfo: { type: "boolean", description: "是否获取元素参数信息", default: false } }, required: ["elementId"] } }]
  • TypeScript interface defining the input arguments for get_element_info, used in service and client classes.
    export interface GetElementInfoArgs { elementId: string; getItemPropertyInfo?: boolean; getItemParameterInfo?: boolean; }
  • Generic MCP CallToolRequestSchema handler that dynamically dispatches to RevitService methods based on tool name (e.g., 'get_element_info' -> getElementInfo).
    CallToolRequestSchema, async (request) => { // 获取工具名称 const toolName = request.params.name; // 将工具名称转换为 camelCase 方法名 const methodName = toolName.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase()); // 检查 RevitService 是否有对应的方法 if (typeof (this.revitService as any)[methodName] !== 'function') { throw new McpError( ErrorCode.MethodNotFound, `未知工具: ${toolName}` ); } try { // 动态调用对应的方法 const result = await (this.revitService as any)[methodName](request.params.arguments || {}); //const result = ''; return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Revit API 错误: ${error instanceof Error ? error.message : String(error)}` }], isError: true, } } } ); }

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/PiggyAndrew/revit_mcp'

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