get_ansible_module_info
Retrieve comprehensive schema and documentation for Ansible modules to understand their usage and parameters.
Instructions
Retrieve comprehensive information about an Ansible module including schema and documentation
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| collection_name | Yes | Name of the Ansible collection | |
| module_name | Yes | Name of the module |
Implementation Reference
- The primary handler function that implements the core logic for the 'get_ansible_module_info' tool. It fetches module data from the database using get_module_by_name, handles errors if not found, formats the output including schema, and returns it as TextContent.async def handle_get_ansible_module_info( db: Any, arguments: Dict[str, Any], operation_id: str ) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]: """Handle get_ansible_module_info tool.""" try: logger.info( "Getting Ansible module info", extra={ "collection_name": arguments["collection_name"], "module_name": arguments["module_name"], "operation_id": operation_id, }, ) # Get module info module = get_module_by_name( db, arguments["collection_name"], arguments["module_name"] ) if not module: raise McpError( types.ErrorData( code=types.METHOD_NOT_FOUND, message=f"Module '{arguments['module_name']}' not found in collection '{arguments['collection_name']}'", data={ "tool": "get_ansible_module_info", "collection": arguments["collection_name"], "module": arguments["module_name"], "operation_id": operation_id, }, ) ) # Format output output = [ f"Module: {module['name']}", f"Collection: {module['collection_name']} v{module['collection_version']}", f"Type: {module['type']}", f"Version: {module['version']}", f"Documentation: {module['doc_url']}", "\nSchema:", module["schema"], ] return [TextContent(type="text", text="\n".join(output))] except Exception as e: error_msg = f"Failed to get module info: {str(e)}" logger.error(error_msg, extra={"operation_id": operation_id}) raise McpError( types.ErrorData( code=types.INTERNAL_ERROR, message=error_msg, data={ "tool": "get_ansible_module_info", "operation_id": operation_id, }, ) )
- JSON schema defining the input parameters and validation rules for the get_ansible_module_info tool, specifying required fields collection_name and module_name as strings."get_ansible_module_info": { "type": "object", "description": "Retrieve comprehensive information about an Ansible module including schema and documentation", "required": ["collection_name", "module_name"], "properties": { "collection_name": { "type": "string", "description": "Name of the Ansible collection", }, "module_name": {"type": "string", "description": "Name of the module"}, }, },
- src/iac_memory_mcp_server/tools/ansible.py:559-570 (registration)Dictionary mapping tool names to their handler functions for Ansible tools, registering 'get_ansible_module_info' to its handle_get_ansible_module_info function.ansible_tool_handlers = { "get_ansible_collection_info": handle_get_ansible_collection_info, "list_ansible_collections": handle_list_ansible_collections, "get_collection_version_history": handle_get_collection_version_history, "get_ansible_module_info": handle_get_ansible_module_info, "list_collection_modules": handle_list_collection_modules, "get_module_version_compatibility": handle_get_module_version_compatibility, "add_ansible_collection": handle_add_ansible_collection, "add_ansible_module": handle_add_ansible_module, "update_collection_version": handle_update_collection_version, "update_module_version": handle_update_module_version, }